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

Function cpg_dispatch

lib/cpg.c:370–645  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

368}
369
370cs_error_t cpg_dispatch (
371 cpg_handle_t handle,
372 cs_dispatch_flags_t dispatch_types)
373{
374 int timeout = -1;
375 cs_error_t error;
376 int cont = 1; /* always continue do loop except when set to 0 */
377 struct cpg_inst *cpg_inst;
378 struct res_lib_cpg_confchg_callback *res_cpg_confchg_callback;
379 struct res_lib_cpg_deliver_callback *res_cpg_deliver_callback;
380 struct res_lib_cpg_partial_deliver_callback *res_cpg_partial_deliver_callback;
381 struct res_lib_cpg_totem_confchg_callback *res_cpg_totem_confchg_callback;
382 struct cpg_inst cpg_inst_copy;
383 struct qb_ipc_response_header *dispatch_data;
384 struct cpg_address member_list[CPG_MEMBERS_MAX];
385 struct cpg_address left_list[CPG_MEMBERS_MAX];
386 struct cpg_address joined_list[CPG_MEMBERS_MAX];
387 struct cpg_name group_name;
388 struct cpg_assembly_data *assembly_data;
389 struct qb_list_head *iter, *tmp_iter;
390 mar_cpg_address_t *left_list_start;
391 mar_cpg_address_t *joined_list_start;
392 unsigned int i;
393 struct cpg_ring_id ring_id;
394 uint32_t totem_member_list[CPG_MEMBERS_MAX];
395 int32_t errno_res;
396 char dispatch_buf[IPC_DISPATCH_SIZE];
397
398 error = hdb_error_to_cs (hdb_handle_get (&cpg_handle_t_db, handle, (void *)&cpg_inst));
399 if (error != CS_OK) {
400 return (error);
401 }
402
403 /*
404 * Timeout instantly for CS_DISPATCH_ONE_NONBLOCKING or CS_DISPATCH_ALL and
405 * wait indefinitely for CS_DISPATCH_ONE or CS_DISPATCH_BLOCKING
406 */
407 if (dispatch_types == CS_DISPATCH_ALL || dispatch_types == CS_DISPATCH_ONE_NONBLOCKING) {
408 timeout = 0;
409 }
410
411 dispatch_data = (struct qb_ipc_response_header *)dispatch_buf;
412 do {
413 errno_res = qb_ipcc_event_recv (
414 cpg_inst->c,
415 dispatch_buf,
416 IPC_DISPATCH_SIZE,
417 timeout);
418 error = qb_to_cs_error (errno_res);
419 if (error == CS_ERR_BAD_HANDLE) {
420 error = CS_OK;
421 goto error_put;
422 }
423 if (error == CS_ERR_TRY_AGAIN) {
424 if (dispatch_types == CS_DISPATCH_ONE_NONBLOCKING) {
425 /*
426 * Don't mask error
427 */

Callers 9

mainFunction · 0.85
mainFunction · 0.85
dispatch_threadFunction · 0.85
dispatch_threadFunction · 0.85
cpg_benchmarkFunction · 0.85
mainFunction · 0.85
mainFunction · 0.85
mainFunction · 0.85
dispatchFunction · 0.85

Calls 7

hdb_error_to_csFunction · 0.85
hdb_handle_getFunction · 0.85
qb_to_cs_errorFunction · 0.85
hdb_handle_putFunction · 0.85

Tested by 3

mainFunction · 0.68
mainFunction · 0.68
mainFunction · 0.68