void AsyncNameLookup(HANDLE hLookup,int error) { if (error != 0) { /* eprintf("AsyncSocketNameLookup got error %i\n",error); */ return; } name_lookup_handle = hLookup; EnterServerLock(); ForEachSession(AsyncEachSessionNameLookup); LeaveServerLock(); }
void UpdateSecurityRedbook() { // Okay, timing is important here: // The _redbookstring must be updated to any new value // before we call GameEchoPing() on any sessions, but the // current strings held by any of the sessions now must // remain valid so the GameEchoPing() output doesn't access // a freed old string. // // We remember the old string for comparisons and for freeing last. // We get the new resource. // We update _redbookstring and _redbookid. // We see if users need an update at all. // We free the string which sessions were using AFTER the GameEchoPing. // char* pRscName; char* old; resource_node* r = NULL; old = _redbookstring; _redbookstring = NULL; _redbookid = 0; pRscName = LockConfigStr(SECURITY_REDBOOK_RSC); if (pRscName) r = GetResourceByName(pRscName); UnlockConfigStr(); if (r) { if (!old || (r->resource_val && 0 != strcmp(old,r->resource_val))) _redbookstring = strdup(r->resource_val); else _redbookstring = old; _redbookid = r->resource_id; } if (old != _redbookstring) { ForEachSession(GameEchoPing); if (old) free(old); } }
void UnpauseTimers(void) { int add_time; if (pause_time == 0) { eprintf("UnpauseTimers called when they were not paused\n"); return; } add_time = 1000*(GetTime() - pause_time); for (int i = 0; i < numActiveTimers; ++i) timer_heap[i]->time += add_time; pause_time = 0; /* after timers unpaused, we should reset last message times of people in the game so they aren't logged because of what seems to be lag */ ForEachSession(ResetLastMessageTimes); }