From 0884c559ef9eaf2e9594625527ba760b3588ce36 Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Sun, 18 Feb 2007 04:37:06 +0000 Subject: [PATCH] update git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@4315 d0543943-73ff-0310-b7d9-9358b9ac24b2 --- src/switch_rtp.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/switch_rtp.c b/src/switch_rtp.c index a206db437e..df1f4d7c9f 100644 --- a/src/switch_rtp.c +++ b/src/switch_rtp.c @@ -567,7 +567,7 @@ SWITCH_DECLARE(void) switch_rtp_kill_socket(switch_rtp_t *rtp_session) SWITCH_DECLARE(uint8_t) switch_rtp_ready(switch_rtp_t *rtp_session) { - return (rtp_session != NULL && rtp_session->ready) ? 1 : 0; + return (rtp_session != NULL && rtp_session->sock && rtp_session->ready) ? 1 : 0; } SWITCH_DECLARE(void) switch_rtp_destroy(switch_rtp_t **rtp_session) @@ -576,6 +576,8 @@ SWITCH_DECLARE(void) switch_rtp_destroy(switch_rtp_t **rtp_session) return; } + rtp_session->ready = 0; + switch_mutex_lock((*rtp_session)->flag_mutex); if ((*rtp_session)->dtmf_data.dtmf_buffer) { @@ -760,7 +762,7 @@ static int rtp_common_read(switch_rtp_t *rtp_session, switch_payload_t *payload_ rtp_session->last_time = switch_time_now(); } - while(rtp_session->ready) { + while(switch_rtp_ready(rtp_session)) { bytes = sizeof(rtp_msg_t); status = switch_socket_recvfrom(rtp_session->from_addr, rtp_session->sock, 0, (void *)&rtp_session->recv_msg, &bytes);