]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
FSCORE-365
authorAnthony Minessale <anthony.minessale@gmail.com>
Tue, 12 May 2009 16:46:16 +0000 (16:46 +0000)
committerAnthony Minessale <anthony.minessale@gmail.com>
Tue, 12 May 2009 16:46:16 +0000 (16:46 +0000)
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@13286 d0543943-73ff-0310-b7d9-9358b9ac24b2

src/switch_apr.c
src/switch_rtp.c

index a24dc361e801c78c0b70a207fb6ab48ee752e190..55ddea5cd0025eadc61908331de24ef9800c9342 100644 (file)
@@ -786,15 +786,23 @@ SWITCH_DECLARE(switch_status_t) switch_pollset_create(switch_pollset_t **pollset
 
 SWITCH_DECLARE(switch_status_t) switch_pollset_add(switch_pollset_t *pollset, const switch_pollfd_t *descriptor)
 {
+       if (!pollset) {
+               return SWITCH_STATUS_FALSE;
+       }
+       
        return apr_pollset_add((apr_pollset_t *)pollset, (const apr_pollfd_t *)descriptor);
 }
 
 SWITCH_DECLARE(switch_status_t) switch_poll(switch_pollfd_t *aprset, int32_t numsock, int32_t *nsds, switch_interval_time_t timeout)
 {
-       apr_status_t st = apr_poll((apr_pollfd_t *)aprset, numsock, nsds, timeout);
+       apr_status_t st = SWITCH_STATUS_FALSE;
+       
+       if (aprset) {
+               st = apr_poll((apr_pollfd_t *)aprset, numsock, nsds, timeout);
 
-       if (st == APR_TIMEUP) {
-               st = SWITCH_STATUS_TIMEOUT;
+               if (st == APR_TIMEUP) {
+                       st = SWITCH_STATUS_TIMEOUT;
+               }
        }
 
        return st;
index 2bf5465646fdf49f5d5571067f8064f2ced676e9..713835841d63f4386ebca536d9e28951dde50cec 100644 (file)
@@ -1475,7 +1475,8 @@ static int rtp_common_read(switch_rtp_t *rtp_session, switch_payload_t *payload_
                int do_cng = 0;
 
                if (rtp_session->timer.interval) {
-                       if (switch_test_flag(rtp_session, SWITCH_RTP_FLAG_AUTOFLUSH) || switch_test_flag(rtp_session, SWITCH_RTP_FLAG_STICKY_FLUSH)) {
+                       if ((switch_test_flag(rtp_session, SWITCH_RTP_FLAG_AUTOFLUSH) || switch_test_flag(rtp_session, SWITCH_RTP_FLAG_STICKY_FLUSH)) &&
+                               rtp_session->read_pollfd) {
                                if (switch_poll(rtp_session->read_pollfd, 1, &fdr, 1) == SWITCH_STATUS_SUCCESS) {
                                        hot_socket = 1;
                                }
@@ -1487,7 +1488,7 @@ static int rtp_common_read(switch_rtp_t *rtp_session, switch_payload_t *payload_
 
        recvfrom:
 
-               if (!rtp_session->timer.interval) {
+               if (!rtp_session->timer.interval && rtp_session->read_pollfd) {
                        poll_status = switch_poll(rtp_session->read_pollfd, 1, &fdr, poll_sec * 1000000);
                }