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

Function freeClient

src/redis-benchmark.cpp:393–416  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

391}
392
393static void freeClient(client c) {
394 aeEventLoop *el = CLIENT_GET_EVENTLOOP(c);
395 listNode *ln;
396 aeDeleteFileEvent(el,c->context->fd,AE_WRITABLE);
397 aeDeleteFileEvent(el,c->context->fd,AE_READABLE);
398 if (c->thread_id >= 0) {
399 int requests_finished = 0;
400 atomicGet(config.requests_finished, requests_finished);
401 if (requests_finished >= config.requests) {
402 aeStop(el);
403 }
404 }
405 redisFree(c->context);
406 sdsfree(c->obuf);
407 zfree(c->randptr);
408 zfree(c->stagptr);
409 zfree(c);
410 if (config.num_threads) pthread_mutex_lock(&(config.liveclients_mutex));
411 config.liveclients--;
412 ln = listSearchKey(config.clients,c);
413 assert(ln != NULL);
414 listDelNode(config.clients,ln);
415 if (config.num_threads) pthread_mutex_unlock(&(config.liveclients_mutex));
416}
417
418static void freeAllClients(void) {
419 listNode *ln = config.clients->head, *next;

Callers 3

freeAllClientsFunction · 0.70
clientDoneFunction · 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