]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
treat EINTR returns as a BREAK (now mapped to SWITCH_STATUS_INTR), we appriciate...
authorAnthony Minessale <anthm@freeswitch.org>
Tue, 11 Jan 2011 21:09:03 +0000 (15:09 -0600)
committerAnthony Minessale <anthm@freeswitch.org>
Tue, 11 Jan 2011 21:09:03 +0000 (15:09 -0600)
src/include/switch_types.h
src/include/switch_utils.h
src/switch_rtp.c

index 9a5e09db7c6eff0cb6e6af92135c048dc7039514..3972404290e70e079a949af2910e45471b05174f 100644 (file)
@@ -859,7 +859,7 @@ typedef enum {
        SWITCH_STATUS_FALSE,
        SWITCH_STATUS_TIMEOUT,
        SWITCH_STATUS_RESTART,
-       SWITCH_STATUS_TERM,
+       SWITCH_STATUS_INTR,
        SWITCH_STATUS_NOTIMPL,
        SWITCH_STATUS_MEMERR,
        SWITCH_STATUS_NOOP,
@@ -876,6 +876,7 @@ typedef enum {
        SWITCH_STATUS_TOO_SMALL,
        SWITCH_STATUS_FOUND,
        SWITCH_STATUS_CONTINUE,
+       SWITCH_STATUS_TERM,
        SWITCH_STATUS_NOT_INITALIZED
 } switch_status_t;
 
index 4771dba40a795597d452362a0df2265e787463a0..2c4de143345dc0efc82593c9eea25f5dec8cf3b8 100644 (file)
@@ -327,7 +327,7 @@ SWITCH_DECLARE(unsigned short) get_port(struct sockaddr *sa);
  */
 SWITCH_DECLARE(int) switch_build_uri(char *uri, switch_size_t size, const char *scheme, const char *user, const switch_sockaddr_t *sa, int flags);
 
-#define SWITCH_STATUS_IS_BREAK(x) (x == SWITCH_STATUS_BREAK || x == 730035 || x == 35)
+#define SWITCH_STATUS_IS_BREAK(x) (x == SWITCH_STATUS_BREAK || x == 730035 || x == 35 || x == SWITCH_STATUS_INTR)
 
 /*!
   \brief Return a printable name of a switch_priority_t
index 038e1d981b8ad1b46fd7357acd95865c775c2681..1b7500dd8c2f20f4ff9bf0440415116d0f283b43 100644 (file)
@@ -2440,6 +2440,7 @@ static int rtp_common_read(switch_rtp_t *rtp_session, switch_payload_t *payload_
        recvfrom:
                bytes = 0;
                read_loops++;
+               poll_loop = 0;
 
                if (!switch_rtp_ready(rtp_session)) {
                        break;
@@ -2466,21 +2467,27 @@ static int rtp_common_read(switch_rtp_t *rtp_session, switch_payload_t *payload_
                        status = read_rtp_packet(rtp_session, &bytes, flags);
                } else {
                        if (!SWITCH_STATUS_IS_BREAK(poll_status) && poll_status != SWITCH_STATUS_TIMEOUT) {
+                               char tmp[128] = "";
+                               strerror_r(poll_status, tmp, sizeof(tmp));
+                               switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Poll failed with error: %d [%s]\n", poll_status, tmp);
                                ret = -1;
                                goto end;
                        }
 
                        poll_loop = 1;
-                       rtp_session->missed_count += (poll_sec * 1000) / (rtp_session->ms_per_packet ? rtp_session->ms_per_packet / 1000 : 20);
-                       bytes = 0;
 
-                       if (rtp_session->max_missed_packets) {
-                               if (rtp_session->missed_count >= rtp_session->max_missed_packets) {
-                                       ret = -2;
-                                       goto end;
+                       if (!switch_test_flag(rtp_session, SWITCH_RTP_FLAG_UDPTL)) {
+                               rtp_session->missed_count += (poll_sec * 1000) / (rtp_session->ms_per_packet ? rtp_session->ms_per_packet / 1000 : 20);
+                               bytes = 0;
+
+                               if (rtp_session->max_missed_packets) {
+                                       if (rtp_session->missed_count >= rtp_session->max_missed_packets) {
+                                               ret = -2;
+                                               goto end;
+                                       }
                                }
                        }
-                       
+
                        if ((!(io_flags & SWITCH_IO_FLAG_NOBLOCK)) && 
                                (rtp_session->dtmf_data.out_digit_dur == 0 || switch_test_flag(rtp_session, SWITCH_RTP_FLAG_VIDEO))) {
                                return_cng_frame();