select on write for openzap to avoid overrun on the td, channel

git-svn-id: http://svn.openzap.org/svn/openzap/trunk@782 a93c3328-9c30-0410-af19-c9cd2b2d52af
This commit is contained in:
Anthony Minessale committed 2009-07-24 16:01:33 +00:00
1 parent cc138af513
commit 193bb790a2
3 files changed
+10 -81

No files matched your search

+10 -1
View 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) {