LdapSessionPool::~LdapSessionPool(void) { assert(!_waiters); // Close all the sessions in the free list. LdapSession *session; CListIterator<LdapSession> free_iterator (&_free_list); while (session = ++free_iterator) { _free_list.Delete (session); session->_release (); } // if there's anybody on the active list, then this object // cannot be destroyed, because the user of that session will come back // to return the session to us. int count = _active_list.NumEntries(); assert (count < 2); // allow a thread for the invalidator. // Destroy the semaphore object. PR_DestroyCondVar (_cvar); PR_DestroyLock (_lock); // Remove this pool from the list of all pools PR_Lock(_poolListLock); LdapSessionPool **pp; for (pp = &_poolList; *pp; pp = &(*pp)->_nextPool) { if (*pp == this) { *pp = _nextPool; break; } } PR_Unlock(_poolListLock); }
void LdapSessionPool::free_ldap_session(LDAP *ld) { LdapSessionPool *pp; LdapSession *session; PR_Lock(_poolListLock); for (pp = _poolList; pp; pp = pp->_nextPool) { PR_Lock(pp->_lock); CListIterator<LdapSession> free_iterator (&pp->_active_list); while (session = ++free_iterator) { if (session->getSession() == ld) { PR_Unlock(_poolListLock); session->setUnbound(); pp->add_free_session(session); PR_Unlock(pp->_lock); return; } } PR_Unlock(pp->_lock); } // this shouldn't happen assert(ld == NULL); PR_Unlock(_poolListLock); }
static int u2dump(char *file) { u2record record; u2iterator *it = new_iterator(file); memset(&record, 0, sizeof(record)); if(!it) { printf("u2dump: Failed to create new iterator with file: %s\n", file); return -1; } while( get_record(it, &record) == SUCCESS ) { if(record.type == UNIFIED2_IDS_EVENT) event_dump(&record); else if(record.type == UNIFIED2_IDS_EVENT_VLAN) event2_dump(&record); else if(record.type == UNIFIED2_PACKET) packet_dump(&record); else if(record.type == UNIFIED2_IDS_EVENT_IPV6) event6_dump(&record); else if(record.type == UNIFIED2_IDS_EVENT_IPV6_VLAN) event2_6_dump(&record); else if(record.type == UNIFIED2_EXTRA_DATA) extradata_dump(&record); #if defined(FEAT_OPEN_APPID) else if(record.type == UNIFIED2_IDS_EVENT_APPID) event3_dump(&record); else if(record.type == UNIFIED2_IDS_EVENT_APPID_IPV6) event3_6_dump(&record); else if(record.type == UNIFIED2_IDS_EVENT_APPSTAT) appid_dump(&record); #endif /* defined(FEAT_OPEN_APPID) */ } free_iterator(it); if(record.data) free(record.data); return 0; }
void list_traverse(const list_t* list, int direction, void (*func)(node_t*)) { node_t *node; list_iterator_t *it = get_iterator(list, direction); while ((node = iterator_next(it)) != NULL) { func(node); } free_iterator(it); }
void ZSTLFinishEnum(struct ZSTLMap *pm, struct ZSTLIterator *iterator) { do_lock(&(pm->mutex)); #ifdef SANDISK_PRINTSTUFF fprintf(stderr, "ZSTLFinishEnum: pm=%p, iterator=%p\n", pm, iterator); #endif free_iterator(pm, iterator); pthread_mutex_unlock(&(pm->enum_mutex)); do_unlock(&(pm->mutex)); }