extern int bits_va_lock_check(void) { t_entry * curr; t_account * account; int count = 0; HASHTABLE_TRAVERSE(accountlist(),curr) { account = entry_get_data(curr); if ((account_get_bits_state(account)==account_state_delete)||(account_get_bits_state(account)==account_state_invalid)) { bits_va_unlock_account(account); count++; curr=hashtable_get_first(accountlist()); /* restart */ } }
void Ladders::rebuild(std::list<LadderList*>& laddersToRebuild) { t_entry * curr; t_account * account; unsigned int uid, primary, secondary, tertiary; eventlog(eventlog_level_debug,__FUNCTION__,"start rebuilding ladders"); if (accountlist_load_all(ST_FORCE)) { eventlog(eventlog_level_error, __FUNCTION__, "error loading all accounts"); return; } HASHTABLE_TRAVERSE(accountlist(),curr) { if ((account=((t_account *)entry_get_data(curr)))) { LadderReferencedObject referencedObject(account); for (std::list<LadderList*>::iterator lit(laddersToRebuild.begin()); lit!=laddersToRebuild.end(); lit++) { // only do handle referenceTypeAccount ladders here if ((*lit)->getReferenceType() != referenceTypeAccount) { continue; } if (referencedObject.getData((*lit)->getLadderKey(),uid,primary,secondary,tertiary)) { (*lit)->addEntry(uid, primary, secondary, tertiary, referencedObject); } } } } // now we would need to traverse teamlist, too. // how about comletly moving this code into team? eventlog(eventlog_level_debug,__FUNCTION__,"done rebuilding ladders"); }
extern int accountlist_destroy(void) { t_entry * curr; t_account * account; HASHTABLE_TRAVERSE(accountlist_head,curr) { if (!(account = entry_get_data(curr))) eventlog(eventlog_level_error,__FUNCTION__,"found NULL account in list"); else { if (account_flush(account, FS_FORCE)<0) eventlog(eventlog_level_error,__FUNCTION__,"could not save account"); account_destroy(account); } hashtable_remove_entry(accountlist_head,curr); } HASHTABLE_TRAVERSE(accountlist_uid_head,curr) { hashtable_remove_entry(accountlist_head,curr); }