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

Function dm_get_cond

modules/aaa_diameter/dm_impl.c:109–141  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

107};
108
109static struct dm_cond *dm_get_cond(int type, diameter_reply_cb *cb, void *param)
110{
111 struct dm_cond *cond = shm_malloc(sizeof *cond);
112 if (!cond) {
113 LM_ERR("oom\n");
114 return NULL;
115 }
116 memset(cond, 0, sizeof *cond);
117 cond->ref = 1;
118 cond->type = type;
119 switch (type) {
120 case DM_TYPE_EVENT:
121 cond->sync.event.pid = process_no;
122 cond->sync.event.fd = eventfd(0, 0);
123 if (cond->sync.event.fd < 0) {
124 LM_ERR("could not create event fd\n");
125 shm_free(cond);
126 return NULL;
127 }
128 break;
129 case DM_TYPE_COND:
130 init_mutex_cond(&cond->sync.cond.mutex, &cond->sync.cond.cond);
131 break;
132 case DM_TYPE_CB:
133 if (!cb)
134 LM_WARN("no callback specified\n");
135 cond->sync.cb.f = cb;
136 cond->sync.cb.p = param;
137 break;
138 }
139
140 return cond;
141}
142
143int dm_init_reply_cond(int proc_rank)
144{

Callers 3

dm_init_reply_condFunction · 0.85
_dm_send_message_asyncFunction · 0.85

Calls 3

shm_mallocFunction · 0.85
shm_freeFunction · 0.85
init_mutex_condFunction · 0.70

Tested by

no test coverage detected