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

Function freeClusterLink

src/cluster.cpp:666–688  ·  view source on GitHub ↗

Free a cluster link, but does not free the associated node of course. * This function will just make sure that the original node associated * with this link will have the 'link' field set to NULL. */

Source from the content-addressed store, hash-verified

664 * This function will just make sure that the original node associated
665 * with this link will have the 'link' field set to NULL. */
666void freeClusterLink(clusterLink *link) {
667 if (ielFromEventLoop(serverTL->el) != IDX_EVENT_LOOP_MAIN)
668 {
669 // we can't perform this operation on this thread, queue it on the main thread
670 if (link->node)
671 link->node->link = NULL;
672 link->node = nullptr;
673 int res = aePostFunction(g_pserver->rgthreadvar[IDX_EVENT_LOOP_MAIN].el, [link]{
674 freeClusterLink(link);
675 });
676 serverAssert(res == AE_OK);
677 return;
678 }
679 if (link->conn) {
680 connClose(link->conn);
681 link->conn = NULL;
682 }
683 sdsfree(link->sndbuf);
684 zfree(link->rcvbuf);
685 if (link->node)
686 link->node->link = NULL;
687 zfree(link);
688}
689
690static void clusterConnAcceptHandler(connection *conn) {
691 serverAssert(ielFromEventLoop(serverTL->el) == IDX_EVENT_LOOP_MAIN);

Callers 7

freeClusterNodeFunction · 0.85
clusterProcessPacketFunction · 0.85
handleLinkIOErrorFunction · 0.85
clusterCronFunction · 0.85

Calls 5

ielFromEventLoopFunction · 0.85
aePostFunctionFunction · 0.85
connCloseFunction · 0.85
sdsfreeFunction · 0.85
zfreeFunction · 0.85

Tested by

no test coverage detected