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. */
| 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. */ |
| 1350 | int 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 |
no test coverage detected