Drop all connections to other sentinels. Returns the number of connections * dropped.*/
| 1169 | /* Drop all connections to other sentinels. Returns the number of connections |
| 1170 | * dropped.*/ |
| 1171 | int sentinelDropConnections(void) { |
| 1172 | dictIterator *di; |
| 1173 | dictEntry *de; |
| 1174 | int dropped = 0; |
| 1175 | |
| 1176 | di = dictGetIterator(sentinel.masters); |
| 1177 | while ((de = dictNext(di)) != NULL) { |
| 1178 | dictIterator *sdi; |
| 1179 | dictEntry *sde; |
| 1180 | |
| 1181 | sentinelRedisInstance *ri = (sentinelRedisInstance*)dictGetVal(de); |
| 1182 | sdi = dictGetIterator(ri->sentinels); |
| 1183 | while ((sde = dictNext(sdi)) != NULL) { |
| 1184 | sentinelRedisInstance *si = (sentinelRedisInstance*)dictGetVal(sde); |
| 1185 | if (!si->link->disconnected) { |
| 1186 | instanceLinkCloseConnection(si->link, si->link->pc); |
| 1187 | instanceLinkCloseConnection(si->link, si->link->cc); |
| 1188 | dropped++; |
| 1189 | } |
| 1190 | } |
| 1191 | dictReleaseIterator(sdi); |
| 1192 | } |
| 1193 | dictReleaseIterator(di); |
| 1194 | |
| 1195 | return dropped; |
| 1196 | } |
| 1197 | |
| 1198 | /* When we detect a Sentinel to switch address (reporting a different IP/port |
| 1199 | * pair in Hello messages), let's update all the matching Sentinels in the |
no test coverage detected