# HG changeset patch # User Mychaela Falconia # Date 1664419516 28800 # Node ID 7a4d4b8d5f04b86e68c5013f58b2dab174465073 # Parent c1c94b7fc2e278a9041bb28d917c8f09978674a1 sip-in call clearing: unlink and free implemented diff -r c1c94b7fc2e2 -r 7a4d4b8d5f04 sip-in/call_clear.c --- a/sip-in/call_clear.c Wed Sep 28 18:37:19 2022 -0800 +++ b/sip-in/call_clear.c Wed Sep 28 18:45:16 2022 -0800 @@ -44,3 +44,20 @@ return; call->overall_state = OVERALL_STATE_DEAD_SIP; } + +void +clear_dead_sip_calls() +{ + struct call *call, **pp; + + for (pp = &call_list; *pp; ) { + call = *pp; + if (call->overall_state == OVERALL_STATE_DEAD_SIP && + call->sip_clear_time >= cur_event_time.tv_sec) { + *pp = call->next; + free(call); + continue; + } + pp = &call->next; + } +} diff -r c1c94b7fc2e2 -r 7a4d4b8d5f04 sip-in/main.c --- a/sip-in/main.c Wed Sep 28 18:37:19 2022 -0800 +++ b/sip-in/main.c Wed Sep 28 18:45:16 2022 -0800 @@ -75,15 +75,15 @@ exit(1); } gettimeofday(&cur_event_time, 0); - if (rc == 0) { + if (rc) { + if (gsm_is_connected && FD_ISSET(gsm_socket, &fds)) + gsm_socket_select(); + if (mgw_is_connected && FD_ISSET(mgw_socket, &fds)) + mgw_socket_select(); + if (FD_ISSET(sip_socket, &fds)) + sip_socket_select(); + } else if (need_retrans) run_periodic_retrans(); - continue; - } - if (gsm_is_connected && FD_ISSET(gsm_socket, &fds)) - gsm_socket_select(); - if (mgw_is_connected && FD_ISSET(mgw_socket, &fds)) - mgw_socket_select(); - if (FD_ISSET(sip_socket, &fds)) - sip_socket_select(); + clear_dead_sip_calls(); } }