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

Function main

test/testcpg.c:296–438  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

294}
295
296int main (int argc, char *argv[]) {
297 cpg_handle_t handle;
298 fd_set read_fds;
299 int select_fd;
300 int result;
301 int retries;
302 const char *options = "i";
303 int opt;
304 unsigned int nodeid;
305 char *fgets_res;
306 struct cpg_address member_list[CPG_MEMBERS_MAX];
307 int member_list_entries;
308 int i;
309 int recnt;
310 int doexit;
311 const char *exitStr = "EXIT";
312
313 doexit = 0;
314
315#ifdef QBLOG
316 qb_log_init("testcpg", LOG_USER, LOG_ERR);
317 qb_log_ctl(QB_LOG_SYSLOG, QB_LOG_CONF_ENABLED, QB_FALSE);
318 qb_log_filter_ctl(QB_LOG_STDERR, QB_LOG_FILTER_ADD,
319 QB_LOG_FILTER_FILE, "*", LOG_TRACE);
320 qb_log_ctl(QB_LOG_STDERR, QB_LOG_CONF_ENABLED, QB_TRUE);
321 qb_log_format_set(QB_LOG_STDERR, "[%p] %f %b");
322#endif
323
324 while ( (opt = getopt(argc, argv, options)) != -1 ) {
325 switch (opt) {
326 case 'i':
327 show_ip = 1;
328 break;
329 }
330 }
331
332 if (argc > optind) {
333 if (strlen(argv[optind]) >= CPG_MAX_NAME_LENGTH) {
334 fprintf(stderr, "Invalid name for cpg group\n");
335 return (1);
336 }
337
338 strcpy(group_name.value, argv[optind]);
339 group_name.length = strlen(argv[optind]);
340 }
341 else {
342 strcpy(group_name.value, "GROUP");
343 group_name.length = 6;
344 }
345 recnt = 0;
346
347 printf ("Type %s to finish\n", exitStr);
348 restart = 1;
349
350 do {
351 if(restart) {
352 restart = 0;
353 retries = 0;

Callers

nothing calls this directly

Calls 9

cpg_model_initializeFunction · 0.85
cpg_local_getFunction · 0.85
cpg_joinFunction · 0.85
cpg_membership_getFunction · 0.85
cpg_fd_getFunction · 0.85
cpg_leaveFunction · 0.85
cpg_mcast_joinedFunction · 0.85
cpg_dispatchFunction · 0.85
cpg_finalizeFunction · 0.85

Tested by

no test coverage detected