MCPcopy Create free account
hub / github.com/corosync/corosync / print_localnodeid

Function print_localnodeid

test/testcpg.c:272–294  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

270} while (counter < max)
271
272static void print_localnodeid(cpg_handle_t handle)
273{
274 char addrStr[128];
275 unsigned int retries;
276 unsigned int nodeid;
277 struct sockaddr_storage addr;
278 struct sockaddr_in *v4addr = (struct sockaddr_in *)&addr;
279 int result;
280
281 retries = 0;
282
283 cs_repeat(retries, 30, result = cpg_local_get(handle, &nodeid));
284 if (result != CS_OK) {
285 printf ("Could not get local node id\n");
286 } else {
287 v4addr->sin_addr.s_addr = nodeid;
288 if(inet_ntop(AF_INET, (const void *)&v4addr->sin_addr.s_addr,
289 addrStr, (socklen_t)sizeof(addrStr)) == NULL) {
290 addrStr[0] = 0;
291 }
292 printf ("Local node id is %s/" CS_PRI_NODE_ID " result %d\n", addrStr, nodeid, result);
293 }
294}
295
296int main (int argc, char *argv[]) {
297 cpg_handle_t handle;

Callers 1

ConfchgCallbackFunction · 0.85

Calls 1

cpg_local_getFunction · 0.85

Tested by

no test coverage detected