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

Function cpg_join

lib/cpg.c:647–699  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

645}
646
647cs_error_t cpg_join (
648 cpg_handle_t handle,
649 const struct cpg_name *group)
650{
651 cs_error_t error;
652 struct cpg_inst *cpg_inst;
653 struct iovec iov[2];
654 struct req_lib_cpg_join req_lib_cpg_join;
655 struct res_lib_cpg_join response;
656
657 if (group->length > CPG_MAX_NAME_LENGTH) {
658 return (CS_ERR_NAME_TOO_LONG);
659 }
660
661 error = hdb_error_to_cs (hdb_handle_get (&cpg_handle_t_db, handle, (void *)&cpg_inst));
662 if (error != CS_OK) {
663 return (error);
664 }
665
666 /* Now join */
667 req_lib_cpg_join.header.size = sizeof (struct req_lib_cpg_join);
668 req_lib_cpg_join.header.id = MESSAGE_REQ_CPG_JOIN;
669 req_lib_cpg_join.pid = getpid();
670 req_lib_cpg_join.flags = 0;
671
672 switch (cpg_inst->model_data.model) {
673 case CPG_MODEL_V1:
674 req_lib_cpg_join.flags = cpg_inst->model_v1_data.flags;
675 break;
676 }
677
678 marshall_to_mar_cpg_name_t (&req_lib_cpg_join.group_name,
679 group);
680
681 iov[0].iov_base = (void *)&req_lib_cpg_join;
682 iov[0].iov_len = sizeof (struct req_lib_cpg_join);
683
684 do {
685 error = coroipcc_msg_send_reply_receive (cpg_inst->c, iov, 1,
686 &response, sizeof (struct res_lib_cpg_join));
687
688 if (error != CS_OK) {
689 goto error_exit;
690 }
691 } while (response.header.error == CS_ERR_BUSY);
692
693 error = response.header.error;
694
695error_exit:
696 hdb_handle_put (&cpg_handle_t_db, handle);
697
698 return (error);
699}
700
701cs_error_t cpg_leave (
702 cpg_handle_t handle,

Callers 9

mainFunction · 0.85
mainFunction · 0.85
mainFunction · 0.85
connect_and_joinFunction · 0.85
mainFunction · 0.85
mainFunction · 0.85
mainFunction · 0.85
mainFunction · 0.85
joinFunction · 0.85

Calls 5

hdb_error_to_csFunction · 0.85
hdb_handle_getFunction · 0.85
hdb_handle_putFunction · 0.85

Tested by 3

mainFunction · 0.68
mainFunction · 0.68
mainFunction · 0.68