1 /* abandon.c - decode and handle an ldap abandon operation */
3 * Copyright 1998-1999 The OpenLDAP Foundation, All Rights Reserved.
4 * COPYING RESTRICTIONS APPLY, see COPYRIGHT file
8 * Copyright (c) 1995 Regents of the University of Michigan.
11 * Redistribution and use in source and binary forms are permitted
12 * provided that this notice is preserved and that due credit is given
13 * to the University of Michigan at Ann Arbor. The name of the University
14 * may not be used to endorse or promote products derived from this
15 * software without specific prior written permission. This software
16 * is provided ``as is'' without express or implied warranty.
22 #include <ac/socket.h>
37 Debug( LDAP_DEBUG_TRACE, "do_abandon\n", 0, 0, 0 );
40 * Parse the abandon request. It looks like this:
42 * AbandonRequest := MessageID
45 if ( ber_scanf( op->o_ber, "i", &id ) == LBER_ERROR ) {
46 Debug( LDAP_DEBUG_ANY, "do_abandon: ber_scanf failed\n", 0, 0 ,0 );
47 send_ldap_disconnect( conn, op,
48 LDAP_PROTOCOL_ERROR, "decoding error" );
52 if( (rc = get_ctrls( conn, op, 0 )) != LDAP_SUCCESS ) {
53 Debug( LDAP_DEBUG_ANY, "do_abandon: get_ctrls failed\n", 0, 0 ,0 );
57 Debug( LDAP_DEBUG_ARGS, "do_abandon: id=%ld\n", (long) id, 0 ,0 );
60 Debug( LDAP_DEBUG_ANY,
61 "do_abandon: bad msgid %ld\n", (long) id, 0, 0 );
65 notfound = 1; /* not found */
66 ldap_pvt_thread_mutex_lock( &conn->c_mutex );
68 * find the operation being abandoned and set the o_abandon
69 * flag. It's up to the backend to periodically check this
70 * flag and abort the operation at a convenient time.
73 for ( o = conn->c_ops; o != NULL; o = o->o_next ) {
74 if ( o->o_msgid == id ) {
75 ldap_pvt_thread_mutex_lock( &o->o_abandonmutex );
77 ldap_pvt_thread_mutex_unlock( &o->o_abandonmutex );
84 for ( oo = &conn->c_pending_ops;
85 (*oo != NULL) && ((*oo)->o_msgid != id);
99 ldap_pvt_thread_mutex_unlock( &conn->c_mutex );
101 Debug( LDAP_DEBUG_TRACE, "do_abandon: op=%ld %sfound\n",
102 id, notfound ? "not " : "", 0 );