* - reconnects any socket found in the "fs_sockets_down" list * - performs any necessary event subscribe / unsubscribe socket operations */
| 589 | * - performs any necessary event subscribe / unsubscribe socket operations |
| 590 | */ |
| 591 | static void apply_socket_commands(void) |
| 592 | { |
| 593 | struct list_head *_, *__; |
| 594 | fs_evs *sock; |
| 595 | int rc; |
| 596 | |
| 597 | #ifdef EXTRA_DEBUG |
| 598 | LM_DBG("applying FS socket commands\n"); |
| 599 | #endif |
| 600 | |
| 601 | lock_start_write(sockets_esl_lock); |
| 602 | list_for_each_safe(_, __, fs_sockets_esl) { |
| 603 | sock = list_entry(_, fs_evs, esl_cmd_list); |
| 604 | |
| 605 | /* above connect may have failed for this socket; skip it for now */ |
| 606 | if (!SHOULD_KEEP_EVS(sock) || !list_empty(&sock->reconnect_list)) |
| 607 | continue; |
| 608 | |
| 609 | rc = update_event_subscriptions(sock); |
| 610 | if (rc != 0) { |
| 611 | LM_ERR("%d errors while processing sock %s:%d commands\n", |
| 612 | rc, sock->host.s, sock->port); |
| 613 | continue; |
| 614 | } |
| 615 | |
| 616 | list_del(&sock->esl_cmd_list); |
| 617 | INIT_LIST_HEAD(&sock->esl_cmd_list); |
| 618 | } |
| 619 | lock_stop_write(sockets_esl_lock); |
| 620 | |
| 621 | /* we may also clean up some sockets */ |
| 622 | lock_start_write(sockets_lock); |
| 623 | lock_start_write(sockets_down_lock); |
| 624 | handle_reconnects(); |
| 625 | lock_stop_write(sockets_down_lock); |
| 626 | lock_stop_write(sockets_lock); |
| 627 | } |
| 628 | |
| 629 | void fs_conn_mgr_loop(int proc_no) |
| 630 | { |
no test coverage detected