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

Function instanceLinkCloseConnection

src/sentinel.cpp:1073–1084  ·  view source on GitHub ↗

Disconnect a hiredis connection in the context of an instance link. */

Source from the content-addressed store, hash-verified

1071
1072/* Disconnect a hiredis connection in the context of an instance link. */
1073void instanceLinkCloseConnection(instanceLink *link, redisAsyncContext *c) {
1074 if (c == NULL) return;
1075
1076 if (link->cc == c) {
1077 link->cc = NULL;
1078 link->pending_commands = 0;
1079 }
1080 if (link->pc == c) link->pc = NULL;
1081 c->data = NULL;
1082 link->disconnected = 1;
1083 redisAsyncFree(c);
1084}
1085
1086/* Decrement the refcount of a link object, if it drops to zero, actually
1087 * free it and return NULL. Otherwise don't do anything and return the pointer

Callers 6

releaseInstanceLinkFunction · 0.85
sentinelDropConnectionsFunction · 0.85
sentinelResetMasterFunction · 0.85

Calls 1

redisAsyncFreeFunction · 0.85

Tested by

no test coverage detected