MCPcopy Create free account
hub / github.com/OpenSIPS/opensips / do_actions_node_ev

Function do_actions_node_ev

modules/clusterer/clusterer.c:1787–1895  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1785}
1786
1787void do_actions_node_ev(cluster_info_t *clusters, int *select_cluster,
1788 int no_clusters)
1789{
1790 node_info_t *node;
1791 cluster_info_t *cl;
1792 struct local_cap *cap_it;
1793 struct remote_cap *n_cap;
1794 int k;
1795 int rc;
1796 int rst_sync_pending;
1797
1798 for (k = 0, cl = clusters; k < no_clusters && cl; k++, cl = clusters->next) {
1799 if (!select_cluster[k])
1800 continue;
1801
1802 for (node = cl->node_list; node; node = node->next) {
1803 lock_get(node->lock);
1804
1805 if (node->flags & NODE_EVENT_DOWN) {
1806 node->flags &= ~NODE_EVENT_DOWN;
1807 lock_release(node->lock);
1808
1809 for (cap_it = cl->capabilities; cap_it; cap_it = cap_it->next)
1810 if (cap_it->reg.event_cb)
1811 cap_it->reg.event_cb(CLUSTER_NODE_DOWN, node->node_id);
1812
1813 if (report_node_state(CLUSTER_NODE_DOWN, cl->cluster_id,
1814 node->node_id) < 0)
1815 LM_ERR("Failed to report node state change\n");
1816
1817 shtag_event_handler(cl->cluster_id, CLUSTER_NODE_DOWN,
1818 node->node_id);
1819
1820 } else if (node->flags & NODE_EVENT_UP) {
1821 node->flags &= ~NODE_EVENT_UP;
1822
1823 /* check pending sync replies */
1824 for (n_cap = node->capabilities; n_cap; n_cap = n_cap->next) {
1825 if (n_cap->flags & CAP_SYNC_PENDING) {
1826 n_cap->flags &= ~(CAP_SYNC_PENDING|CAP_SYNC_STARTUP);
1827 lock_release(node->lock);
1828 /* reply now that the node is up */
1829 if (ipc_dispatch_sync_reply(cl, node->node_id,
1830 &n_cap->name) < 0)
1831 LM_ERR("Failed to dispatch sync reply job\n");
1832 lock_get(node->lock);
1833 }
1834 }
1835 lock_release(node->lock);
1836
1837 for (cap_it = cl->capabilities; cap_it; cap_it = cap_it->next) {
1838 /* check pending sync request */
1839 rst_sync_pending = 0;
1840 lock_get(cl->lock);
1841 if (cap_it->flags & CAP_SYNC_PENDING) {
1842 lock_release(cl->lock);
1843
1844 if (!match_node(cl->current_node, node,

Callers 9

cl_set_stateFunction · 0.85
clusterer_send_msgFunction · 0.85
clusterer_bcast_msgFunction · 0.85
handle_remove_nodeFunction · 0.85
bin_rcv_cl_extra_packetsFunction · 0.85
bin_rcv_cl_packetsFunction · 0.85
bin_rcv_mod_packetsFunction · 0.85
remove_nodeFunction · 0.85
heartbeats_timerFunction · 0.85

Calls 7

lock_getFunction · 0.85
lock_releaseFunction · 0.85
report_node_stateFunction · 0.85
shtag_event_handlerFunction · 0.85
ipc_dispatch_sync_replyFunction · 0.85
match_nodeFunction · 0.85
send_sync_reqFunction · 0.85

Tested by

no test coverage detected