MCPcopy Create free account
hub / github.com/bloomberg/comdb2 / cdb2_try_connect_range

Function cdb2_try_connect_range

cdb2api/cdb2api.c:2643–2654  ·  view source on GitHub ↗

try to connect to range from 0 to max starting with begin */

Source from the content-addressed store, hash-verified

2641
2642/* try to connect to range from 0 to max starting with begin */
2643static inline int cdb2_try_connect_range(cdb2_hndl_tp *hndl, int begin, int max)
2644{
2645 for (int j = 0; j < max; j++) {
2646 int i = (begin + j) % max;
2647 hndl->node_seq = i + 1;
2648 if (i == hndl->master || i == hndl->connected_host || hndl->hosts_connected[i] == 1)
2649 continue;
2650 if (newsql_connect(hndl, i) == 0)
2651 return 0;
2652 }
2653 return -1;
2654}
2655
2656static int cdb2_get_dbhosts(cdb2_hndl_tp *hndl);
2657

Callers 1

cdb2_connect_sqlhostFunction · 0.85

Calls 1

newsql_connectFunction · 0.85

Tested by

no test coverage detected