1 /* operation.c - routines to deal with pending ldap operations */
8 #include <sys/socket.h>
11 extern time_t currenttime;
12 extern pthread_mutex_t currenttime_mutex;
15 op_free( Operation *op )
17 if ( op->o_ber != NULL )
18 ber_free( op->o_ber, 1 );
19 if ( op->o_dn != NULL ) {
22 /* pthread_mutex_destroy( &op->o_abandonmutex ); */
39 for ( tmp = olist; *tmp != NULL; tmp = &(*tmp)->o_next )
42 *tmp = (Operation *) calloc( 1, sizeof(Operation) );
43 pthread_mutex_init( &(*tmp)->o_abandonmutex,
44 pthread_mutexattr_default );
46 (*tmp)->o_msgid = msgid;
48 (*tmp)->o_abandon = 0;
49 (*tmp)->o_dn = strdup( dn != NULL ? dn : "" );
50 pthread_mutex_lock( ¤ttime_mutex );
51 (*tmp)->o_time = currenttime;
52 pthread_mutex_unlock( ¤ttime_mutex );
54 (*tmp)->o_connid = connid;
55 (*tmp)->o_next = NULL;
61 op_delete( Operation **olist, Operation *op )
65 for ( tmp = olist; *tmp != NULL && *tmp != op; tmp = &(*tmp)->o_next )
69 Debug( LDAP_DEBUG_ANY, "op_delete: can't find op %d\n",
74 *tmp = (*tmp)->o_next;