From 98cdec8d6ff3aed3e50e6a8e4bd5ee1a59f9c622 Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Mon, 27 Jul 2009 23:48:52 +0000 Subject: [PATCH] update git-svn-id: http://svn.openzap.org/svn/openzap/trunk@785 a93c3328-9c30-0410-af19-c9cd2b2d52af --- libs/freetdm/src/ozmod/ozmod_libpri/lpwrap_pri.c | 9 ++++++--- libs/freetdm/src/ozmod/ozmod_libpri/lpwrap_pri.h | 1 + libs/freetdm/src/ozmod/ozmod_libpri/ozmod_libpri.c | 2 +- libs/freetdm/src/ozmod/ozmod_zt/ozmod_zt.c | 5 ----- 4 files changed, 8 insertions(+), 9 deletions(-) diff --git a/libs/freetdm/src/ozmod/ozmod_libpri/lpwrap_pri.c b/libs/freetdm/src/ozmod/ozmod_libpri/lpwrap_pri.c index 762a939a02..1c1a31d2c3 100644 --- a/libs/freetdm/src/ozmod/ozmod_libpri/lpwrap_pri.c +++ b/libs/freetdm/src/ozmod/ozmod_libpri/lpwrap_pri.c @@ -120,9 +120,11 @@ static int __pri_lpwrap_read(struct pri *pri, void *buf, int buflen) if ((zst = zap_channel_read(spri->dchan, buf, &len)) != ZAP_SUCCESS) { if (zst == ZAP_FAIL) { zap_log(ZAP_LOG_CRIT, "span %d D-READ FAIL! [%s]\n", spri->span->span_id, spri->dchan->last_error); + spri->errs++; } else { zap_log(ZAP_LOG_CRIT, "span %d D-READ TIMEOUT\n", spri->span->span_id); } + zap_clear_flag(spri, LPWRAP_PRI_READY); return -1; } @@ -203,9 +205,10 @@ int lpwrap_one_loop(struct lpwrap_pri *spri) } } - //if (!zap_test_flag(spri, LPWRAP_PRI_READY)) { - //return -1; - //} + if (spri->errs >= 2) { + spri->errs = 0; + return -1; + } FD_ZERO(&rfds); FD_ZERO(&efds); diff --git a/libs/freetdm/src/ozmod/ozmod_libpri/lpwrap_pri.h b/libs/freetdm/src/ozmod/ozmod_libpri/lpwrap_pri.h index cae88ccb92..4c79526b9e 100644 --- a/libs/freetdm/src/ozmod/ozmod_libpri/lpwrap_pri.h +++ b/libs/freetdm/src/ozmod/ozmod_libpri/lpwrap_pri.h @@ -103,6 +103,7 @@ struct lpwrap_pri { void *private_info; event_handler eventmap[LPWRAP_PRI_EVENT_MAX]; loop_handler on_loop; + int errs; }; typedef struct lpwrap_pri lpwrap_pri_t; diff --git a/libs/freetdm/src/ozmod/ozmod_libpri/ozmod_libpri.c b/libs/freetdm/src/ozmod/ozmod_libpri/ozmod_libpri.c index 4334f597ce..195af19ed9 100644 --- a/libs/freetdm/src/ozmod/ozmod_libpri/ozmod_libpri.c +++ b/libs/freetdm/src/ozmod/ozmod_libpri/ozmod_libpri.c @@ -878,7 +878,7 @@ static __inline__ void check_events(zap_span_t *span) case ZAP_FAIL: { zap_log(ZAP_LOG_DEBUG, "Event Failure! %d\n", zap_running()); - zap_sleep(5000); + zap_sleep(2000); } break; default: diff --git a/libs/freetdm/src/ozmod/ozmod_zt/ozmod_zt.c b/libs/freetdm/src/ozmod/ozmod_zt/ozmod_zt.c index 085370b76e..a8ce338a63 100644 --- a/libs/freetdm/src/ozmod/ozmod_zt/ozmod_zt.c +++ b/libs/freetdm/src/ozmod/ozmod_zt/ozmod_zt.c @@ -1071,11 +1071,6 @@ static ZIO_READ_FUNCTION(zt_read) *datalen -= 2; } return ZAP_SUCCESS; - } else { - if (zchan->type == ZAP_CHAN_TYPE_DQ921) { - unsigned char buf[25] = {0}; - write(zchan->sockfd, buf, sizeof(buf)); - } } return r == 0 ? ZAP_TIMEOUT : ZAP_FAIL;