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

Function clusterHandshakeInProgress

app/redis-6.2.6/src/cluster.c:1350–1365  ·  view source on GitHub ↗

Return true if we already have a node in HANDSHAKE state matching the * specified ip address and port number. This function is used in order to * avoid adding a new handshake node for the same address multiple times. */

Source from the content-addressed store, hash-verified

1348 * specified ip address and port number. This function is used in order to
1349 * avoid adding a new handshake node for the same address multiple times. */
1350int clusterHandshakeInProgress(char *ip, int port, int cport) {
1351 dictIterator *di;
1352 dictEntry *de;
1353
1354 di = dictGetSafeIterator(server.cluster->nodes);
1355 while((de = dictNext(di)) != NULL) {
1356 clusterNode *node = dictGetVal(de);
1357
1358 if (!nodeInHandshake(node)) continue;
1359 if (!strcasecmp(node->ip,ip) &&
1360 node->port == port &&
1361 node->cport == cport) break;
1362 }
1363 dictReleaseIterator(di);
1364 return de != NULL;
1365}
1366
1367/* Start a handshake with the specified address if there is not one
1368 * already in progress. Returns non-zero if the handshake was actually

Callers 1

clusterStartHandshakeFunction · 0.85

Calls 4

dictGetSafeIteratorFunction · 0.85
strcasecmpFunction · 0.85
dictNextFunction · 0.70
dictReleaseIteratorFunction · 0.70

Tested by

no test coverage detected