1 /* abandon.c - decode and handle an ldap abandon operation */
4 * Copyright (c) 1995 Regents of the University of Michigan.
7 * Redistribution and use in source and binary forms are permitted
8 * provided that this notice is preserved and that due credit is given
9 * to the University of Michigan at Ann Arbor. The name of the University
10 * may not be used to endorse or promote products derived from this
11 * software without specific prior written permission. This software
12 * is provided ``as is'' without express or implied warranty.
18 #include <ac/socket.h>
32 Debug( LDAP_DEBUG_TRACE, "do_abandon\n", 0, 0, 0 );
35 * Parse the abandon request. It looks like this:
37 * AbandonRequest := MessageID
40 if ( ber_scanf( op->o_ber, "i", &id ) == LBER_ERROR ) {
41 Debug( LDAP_DEBUG_ANY, "ber_scanf failed\n", 0, 0 ,0 );
45 Debug( LDAP_DEBUG_ARGS, "do_abandon: id %d\n", id, 0 ,0 );
48 * find the operation being abandoned and set the o_abandon
49 * flag. It's up to the backend to periodically check this
50 * flag and abort the operation at a convenient time.
53 ldap_pvt_thread_mutex_lock( &conn->c_mutex );
55 for ( o = conn->c_ops; o != NULL; o = o->o_next ) {
56 if ( o->o_msgid == id ) {
57 ldap_pvt_thread_mutex_lock( &o->o_abandonmutex );
59 ldap_pvt_thread_mutex_unlock( &o->o_abandonmutex );
65 for ( oo = &conn->c_pending_ops;
66 (*oo != NULL) && ((*oo)->o_msgid != id);
80 Debug( LDAP_DEBUG_TRACE, "do_abandon: op not found\n", 0, 0, 0 );
83 ldap_pvt_thread_mutex_unlock( &conn->c_mutex );