1 /* operation.c - routines to deal with pending ldap operations */
6 #include <sys/socket.h>
9 extern time_t currenttime;
10 extern pthread_mutex_t currenttime_mutex;
13 op_free( Operation *op )
15 if ( op->o_ber != NULL )
16 ber_free( op->o_ber, 1 );
17 if ( op->o_dn != NULL ) {
20 /* pthread_mutex_destroy( &op->o_abandonmutex ); */
37 for ( tmp = olist; *tmp != NULL; tmp = &(*tmp)->o_next )
40 *tmp = (Operation *) calloc( 1, sizeof(Operation) );
41 pthread_mutex_init( &(*tmp)->o_abandonmutex,
42 pthread_mutexattr_default );
44 (*tmp)->o_msgid = msgid;
46 (*tmp)->o_abandon = 0;
47 (*tmp)->o_dn = strdup( dn != NULL ? dn : "" );
48 pthread_mutex_lock( ¤ttime_mutex );
49 (*tmp)->o_time = currenttime;
50 pthread_mutex_unlock( ¤ttime_mutex );
52 (*tmp)->o_connid = connid;
53 (*tmp)->o_next = NULL;
59 op_delete( Operation **olist, Operation *op )
63 for ( tmp = olist; *tmp != NULL && *tmp != op; tmp = &(*tmp)->o_next )
67 Debug( LDAP_DEBUG_ANY, "op_delete: can't find op %d\n",
72 *tmp = (*tmp)->o_next;