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

Function createInstanceLink

app/redis-6.2.6/src/sentinel.c:1043–1064  ·  view source on GitHub ↗

Create a not yet connected link object. */

Source from the content-addressed store, hash-verified

1041
1042/* Create a not yet connected link object. */
1043instanceLink *createInstanceLink(void) {
1044 instanceLink *link = zmalloc(sizeof(*link));
1045
1046 link->refcount = 1;
1047 link->disconnected = 1;
1048 link->pending_commands = 0;
1049 link->cc = NULL;
1050 link->pc = NULL;
1051 link->cc_conn_time = 0;
1052 link->pc_conn_time = 0;
1053 link->last_reconn_time = 0;
1054 link->pc_last_activity = 0;
1055 /* We set the act_ping_time to "now" even if we actually don't have yet
1056 * a connection with the node, nor we sent a ping.
1057 * This is useful to detect a timeout in case we'll not be able to connect
1058 * with the node at all. */
1059 link->act_ping_time = mstime();
1060 link->last_ping_time = 0;
1061 link->last_avail_time = mstime();
1062 link->last_pong_time = mstime();
1063 return link;
1064}
1065
1066/* Disconnect a hiredis connection in the context of an instance link. */
1067void instanceLinkCloseConnection(instanceLink *link, redisAsyncContext *c) {

Callers 1

Calls 2

zmallocFunction · 0.85
mstimeFunction · 0.70

Tested by

no test coverage detected