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

Function fix_all_socket_lists

net/trans.c:234–274  ·  view source on GitHub ↗

* return 0 on success, -1 on error */

Source from the content-addressed store, hash-verified

232/*
233 * return 0 on success, -1 on error */
234int fix_all_socket_lists(void)
235{
236 int i;
237 int found = 0;
238 static char buf[PROTO_NAME_MAX_SIZE /* currently we shouldn't hardcode that much */];
239 char *p;
240
241 for (i = PROTO_FIRST; i < PROTO_LAST; i++) {
242 if (protos[i].id != PROTO_NONE) {
243 if (fix_socket_list(&protos[i].listeners)!=0) {
244 LM_ERR("fix_socket_list for %d failed\n", protos[i].id);
245 goto error;
246 }
247
248 found++;
249 } else if (proto_has_listeners(i)) {
250 p = proto2str(i, buf);
251 if (p == NULL)
252 goto error;
253 *p = '\0';
254
255 LM_ERR("listeners found for protocol %s, but no module "
256 "can handle it, %d, %d \n", buf,i,protos[i].id);
257 goto error;
258 }
259 }
260
261 /* init the BOND sockets now that we have all the real sockets */
262 if (fix_bond_socket_list(bond_socket_ids) != 0)
263 goto error;
264 bond_socket_ids = NULL;
265
266 if (!found && !testing_framework) {
267 LM_ERR("no listening sockets\n");
268 goto error;
269 }
270
271 return 0;
272error:
273 return -1;
274}
275
276
277int trans_init_all_listeners(void)

Callers 1

mainFunction · 0.85

Calls 3

fix_socket_listFunction · 0.85
proto2strFunction · 0.85
fix_bond_socket_listFunction · 0.85

Tested by

no test coverage detected