MCPcopy Create free account
hub / github.com/F-Stack/f-stack / freeClient

Function freeClient

app/redis-6.2.6/src/redis-benchmark.c:388–411  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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

Callers 3

freeAllClientsFunction · 0.70
clientDoneFunction · 0.70
writeHandlerFunction · 0.70

Calls 9

aeDeleteFileEventFunction · 0.85
aeStopFunction · 0.85
redisFreeFunction · 0.85
sdsfreeFunction · 0.85
pthread_mutex_lockFunction · 0.85
listSearchKeyFunction · 0.85
listDelNodeFunction · 0.85
pthread_mutex_unlockFunction · 0.85
zfreeFunction · 0.70

Tested by

no test coverage detected