| 592 | } |
| 593 | |
| 594 | void put_evs(fs_evs *sock) |
| 595 | { |
| 596 | /* prevents deadlocks on shutdown. |
| 597 | * |
| 598 | * For the FreeSWITCH OpenSIPS module, "graceful shutdowns" are not |
| 599 | * possible, since the main process brutally murders the FS connection |
| 600 | * manager before it gets a chance to gracefully EOF its TCP connections. |
| 601 | */ |
| 602 | if (sr_get_core_status() == STATE_TERMINATING) |
| 603 | return; |
| 604 | |
| 605 | lock_start_write(sockets_lock); |
| 606 | lock_start_write(sockets_down_lock); |
| 607 | sock->ref--; |
| 608 | if (sock->ref == 0) { |
| 609 | if (list_empty(&sock->reconnect_list)) |
| 610 | list_add(&sock->reconnect_list, fs_sockets_down); |
| 611 | } |
| 612 | lock_stop_write(sockets_down_lock); |
| 613 | lock_stop_write(sockets_lock); |
| 614 | |
| 615 | LM_DBG("sock %s:%d, ref=%d, rpl_id=%lu\n", sock->host.s, sock->port, |
| 616 | sock->ref, sock->esl_reply_id); |
| 617 | |
| 618 | /** |
| 619 | * We cannot immediately free the event socket, as the fd might be polled |
| 620 | * by the FreeSWITCH worker process. The ref == 0 check is done there |
| 621 | */ |
| 622 | } |
| 623 | |
| 624 | fs_evs *get_stats_evs(str *fs_url, str *tag) |
| 625 | { |
no test coverage detected