* return 0 on success, -1 on error */
| 232 | /* |
| 233 | * return 0 on success, -1 on error */ |
| 234 | int 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; |
| 272 | error: |
| 273 | return -1; |
| 274 | } |
| 275 | |
| 276 | |
| 277 | int trans_init_all_listeners(void) |
no test coverage detected