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

Function clusterHandshakeInProgress

src/cluster.cpp:1389–1404  ·  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

1387 * specified ip address and port number. This function is used in order to
1388 * avoid adding a new handshake node for the same address multiple times. */
1389int clusterHandshakeInProgress(char *ip, int port, int cport) {
1390 dictIterator *di;
1391 dictEntry *de;
1392
1393 di = dictGetSafeIterator(g_pserver->cluster->nodes);
1394 while((de = dictNext(di)) != NULL) {
1395 clusterNode *node = (clusterNode*)dictGetVal(de);
1396
1397 if (!nodeInHandshake(node)) continue;
1398 if (!strcasecmp(node->ip,ip) &&
1399 node->port == port &&
1400 node->cport == cport) break;
1401 }
1402 dictReleaseIterator(di);
1403 return de != NULL;
1404}
1405
1406/* Start a handshake with the specified address if there is not one
1407 * already in progress. Returns non-zero if the handshake was actually

Callers 1

clusterStartHandshakeFunction · 0.85

Calls 3

dictGetSafeIteratorFunction · 0.85
dictNextFunction · 0.70
dictReleaseIteratorFunction · 0.70

Tested by

no test coverage detected