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