MCPcopy Create free account
hub / github.com/Snapchat/KeyDB / freeClient

Function freeClient

src/keydb-diagnostic-tool.cpp:265–288  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

263}
264
265static void freeClient(client c) {
266 aeEventLoop *el = CLIENT_GET_EVENTLOOP(c);
267 listNode *ln;
268 aeDeleteFileEvent(el,c->context->fd,AE_WRITABLE);
269 aeDeleteFileEvent(el,c->context->fd,AE_READABLE);
270 if (c->thread_id >= 0) {
271 int requests_finished = 0;
272 atomicGet(config.requests_finished, requests_finished);
273 if (requests_finished >= config.requests) {
274 aeStop(el);
275 }
276 }
277 redisFree(c->context);
278 sdsfree(c->obuf);
279 zfree(c->randptr);
280 zfree(c->stagptr);
281 zfree(c);
282 if (config.max_threads) pthread_mutex_lock(&(config.liveclients_mutex));
283 config.liveclients--;
284 ln = listSearchKey(config.clients,c);
285 assert(ln != NULL);
286 listDelNode(config.clients,ln);
287 if (config.max_threads) pthread_mutex_unlock(&(config.liveclients_mutex));
288}
289
290static void freeAllClients(void) {
291 listNode *ln = config.clients->head, *next;

Callers 2

freeAllClientsFunction · 0.70
writeHandlerFunction · 0.70

Calls 7

aeDeleteFileEventFunction · 0.85
aeStopFunction · 0.85
redisFreeFunction · 0.85
sdsfreeFunction · 0.85
zfreeFunction · 0.85
listSearchKeyFunction · 0.85
listDelNodeFunction · 0.85

Tested by

no test coverage detected