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

Function main

test/testcpg2.c:69–92  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

67}
68
69int main(int argc, char** argv) {
70 cpg_handle_t handle=0;
71 cpg_callbacks_t cb={&deliver,&confch};
72 unsigned int nodeid=0;
73 struct cpg_name group={3,"foo"};
74 struct iovec msg={(void *)"hello", 5}; /* discard const */
75
76 struct pollfd pfd;
77 int fd;
78
79 printf ("All of the nodeids should match on a single node configuration\n for the test to pass.");
80 assert(CS_OK==cpg_initialize(&handle, &cb));
81 assert(CS_OK==cpg_local_get(handle,&nodeid));
82 printf("local_get: " CS_PRI_NODE_ID "\n", nodeid);
83 assert(CS_OK==cpg_join(handle, &group));
84 assert(CS_OK==cpg_mcast_joined(handle,CPG_TYPE_AGREED,&msg,1));
85 cpg_fd_get (handle, &fd);
86 pfd.fd = fd;
87 pfd.events = POLLIN;
88
89 assert(poll (&pfd, 1, 1000) == 1);
90 assert(cpg_dispatch(handle, CS_DISPATCH_ALL) == CS_OK);
91 return (0);
92}

Callers

nothing calls this directly

Calls 6

cpg_initializeFunction · 0.85
cpg_local_getFunction · 0.85
cpg_joinFunction · 0.85
cpg_mcast_joinedFunction · 0.85
cpg_fd_getFunction · 0.85
cpg_dispatchFunction · 0.85

Tested by

no test coverage detected