git-svn-id: http://svn.openzap.org/svn/openzap/trunk@783 a93c3328-9c30-0410-af19-c9cd2b2d52af
This commit is contained in:
Anthony Minessale 2009-07-27 23:18:47 +00:00
parent aacd2d68c0
commit 5c0671b1fd
2 changed files with 11 additions and 1 deletions

View File

@ -878,6 +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);
}
break;
default:
@ -947,6 +948,7 @@ static int on_dchan_up(lpwrap_pri_t *spri, lpwrap_pri_event_t event_type, pri_ev
if (!zap_test_flag(spri, LPWRAP_PRI_READY)) {
zap_log(ZAP_LOG_INFO, "Span %d D-Chan UP!\n", spri->span->span_id);
zap_set_flag(spri, LPWRAP_PRI_READY);
zap_set_state_all(spri->span, ZAP_CHANNEL_STATE_RESTART);
}
return 0;
@ -965,6 +967,8 @@ static int on_dchan_down(lpwrap_pri_t *spri, lpwrap_pri_event_t event_type, pri_
if (zap_test_flag(spri, LPWRAP_PRI_READY)) {
zap_log(ZAP_LOG_INFO, "Span %d D-Chan DOWN!\n", spri->span->span_id);
zap_clear_flag(spri, LPWRAP_PRI_READY);
zap_set_state_all(spri->span, ZAP_CHANNEL_STATE_RESTART);
}
return 0;

View File

@ -1055,10 +1055,11 @@ static ZIO_READ_FUNCTION(zt_read)
zap_ssize_t r = 0;
int errs = 0;
while (errs++ < 300) {
while (errs++ < 30) {
if ((r = read(zchan->sockfd, data, *datalen)) > 0) {
break;
}
zap_sleep(10);
if (r == 0) {
errs--;
}
@ -1070,6 +1071,11 @@ 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;