]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
select on write for openzap to avoid overrun on the td, channel
authorAnthony Minessale <anthony.minessale@gmail.com>
Fri, 24 Jul 2009 16:01:33 +0000 (16:01 +0000)
committerAnthony Minessale <anthony.minessale@gmail.com>
Fri, 24 Jul 2009 16:01:33 +0000 (16:01 +0000)
git-svn-id: http://svn.openzap.org/svn/openzap/trunk@782 a93c3328-9c30-0410-af19-c9cd2b2d52af

libs/freetdm/mod_openzap/mod_openzap.c
libs/freetdm/patches/droptest.diff [deleted file]
libs/freetdm/patches/droptest2.diff [deleted file]

index a13a3026e5bfc97372820bdef428c77630f2eaf6..9f190eef5285bc420c60a5c213d02a7e91f142ce 100644 (file)
@@ -664,7 +664,9 @@ static switch_status_t channel_write_frame(switch_core_session_t *session, switc
        private_t *tech_pvt = NULL;
        zap_size_t len;
        unsigned char data[SWITCH_RECOMMENDED_BUFFER_SIZE] = {0};
-       
+       zap_wait_flag_t wflags = ZAP_WRITE;
+       zap_status_t status;
+
        channel = switch_core_session_get_channel(session);
        assert(channel != NULL);
 
@@ -695,6 +697,13 @@ static switch_status_t channel_write_frame(switch_core_session_t *session, switc
        }
 
 
+       wflags = ZAP_WRITE;     
+       status = zap_channel_wait(tech_pvt->zchan, &wflags, tech_pvt->zchan->effective_interval * 4);
+       
+       if (!(wflags & ZAP_WRITE)) {
+               goto fail;
+       }
+
        len = frame->datalen;
        if (zap_channel_write(tech_pvt->zchan, frame->data, frame->buflen, &len) != ZAP_SUCCESS) {
                if (++tech_pvt->wr_error > 10) {
diff --git a/libs/freetdm/patches/droptest.diff b/libs/freetdm/patches/droptest.diff
deleted file mode 100644 (file)
index 5f73a2d..0000000
+++ /dev/null
@@ -1,51 +0,0 @@
-Index: src/ozmod/ozmod_wanpipe/ozmod_wanpipe.c
-===================================================================
---- src/ozmod/ozmod_wanpipe/ozmod_wanpipe.c    (revision 776)
-+++ src/ozmod/ozmod_wanpipe/ozmod_wanpipe.c    (working copy)
-@@ -604,6 +604,8 @@
-               return ZAP_SUCCESS;
-       }
-+      zap_log(ZAP_LOG_ERROR, "FAIL %d\n", bsent);
-+
-       return ZAP_FAIL;
- }
-Index: mod_openzap/mod_openzap.c
-===================================================================
---- mod_openzap/mod_openzap.c  (revision 776)
-+++ mod_openzap/mod_openzap.c  (working copy)
-@@ -674,6 +674,7 @@
-       assert(tech_pvt->zchan != NULL);
-       if (switch_test_flag(tech_pvt, TFLAG_DEAD)) {
-+              switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "DEAD\n");
-               return SWITCH_STATUS_FALSE;
-       }
-@@ -682,6 +683,7 @@
-       }
-       if (!switch_test_flag(tech_pvt, TFLAG_IO)) {
-+              switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "NO FLAG IO\n");
-               goto fail;
-       }
-       
-@@ -689,6 +691,7 @@
-               frame->data = data;
-               frame->buflen = sizeof(data);
-               if ((frame->datalen = tech_pvt->write_codec.implementation->encoded_bytes_per_packet) > frame->buflen) {
-+                      switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "BUF ERR\n");
-                       goto fail;
-               }
-               memset(data, 255, frame->datalen);
-@@ -697,7 +700,9 @@
-       len = frame->datalen;
-       if (zap_channel_write(tech_pvt->zchan, frame->data, frame->buflen, &len) != ZAP_SUCCESS) {
-+              switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "WR ERR\n");
-               if (++tech_pvt->wr_error > 10) {
-+                      switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "10 WR ERR\n");
-                       goto fail;
-               }
-       } else {
diff --git a/libs/freetdm/patches/droptest2.diff b/libs/freetdm/patches/droptest2.diff
deleted file mode 100644 (file)
index 9af97b7..0000000
+++ /dev/null
@@ -1,29 +0,0 @@
-Index: mod_openzap/mod_openzap.c
-===================================================================
---- mod_openzap/mod_openzap.c  (revision 778)
-+++ mod_openzap/mod_openzap.c  (working copy)
-@@ -664,7 +664,9 @@
-       private_t *tech_pvt = NULL;
-       zap_size_t len;
-       unsigned char data[SWITCH_RECOMMENDED_BUFFER_SIZE] = {0};
--      
-+      zap_wait_flag_t wflags = ZAP_WRITE;
-+      zap_status_t status;
-+
-       channel = switch_core_session_get_channel(session);
-       assert(channel != NULL);
-@@ -695,6 +697,13 @@
-       }
-+      wflags = ZAP_WRITE;     
-+      status = zap_channel_wait(tech_pvt->zchan, &wflags, tech_pvt->zchan->effective_interval * 4);
-+      
-+      if (!(wflags & ZAP_WRITE)) {
-+              goto fail;
-+      }
-+
-       len = frame->datalen;
-       if (zap_channel_write(tech_pvt->zchan, frame->data, frame->buflen, &len) != ZAP_SUCCESS) {
-               if (++tech_pvt->wr_error > 10) {