Improved libpri debugging output (where supported), fixed potential Zap crash.

git-svn-id: http://yate.null.ro/svn/yate/trunk@680 acf43c95-373e-0410-b603-e72c3f656dc1
This commit is contained in:
paulc 2006-02-02 19:06:36 +00:00
parent 340aae84bf
commit e2af5fc76e
2 changed files with 31 additions and 9 deletions

View File

@ -52,22 +52,41 @@ using namespace TelEngine;
// default buffer length: 20 ms
static int s_buflen = 160;
#ifdef PRI_NEW_SET_API
#define PRI_CB_STR struct pri *pri,
#else
#define PRI_CB_STR
#endif
static void pri_err_cb(PRI_CB_STR char *s)
#ifdef PRI_NEW_SET_API
static void pri_err_cb(struct pri *pri, char *s)
{
PriSpan* span = pri ? (PriSpan*)::pri_get_userdata(pri) : 0;
if (span)
Debug(span->driver(),DebugWarn,"Span %d: %s",span->span(),s);
else
Debug("PRI",DebugWarn,"%s",s);
}
static void pri_msg_cb(struct pri *pri, char *s)
{
PriSpan* span = pri ? (PriSpan*)::pri_get_userdata(pri) : 0;
if (span)
Debug(span->driver(),DebugInfo,"Span %d: %s",span->span(),s);
else
Debug("PRI",DebugInfo,"%s",s);
}
#else
static void pri_err_cb(char *s)
{
Debug("PRI",DebugWarn,"%s",s);
}
static void pri_msg_cb(PRI_CB_STR char *s)
static void pri_msg_cb(char *s)
{
Debug("PRI",DebugInfo,"%s",s);
}
#endif // PRI_NEW_SET_API
/* Switch types */
static TokenDict dict_str2switch[] = {
{ "unknown", PRI_SWITCH_UNKNOWN },

View File

@ -247,7 +247,7 @@ void ZapSpan::run()
if (FD_ISSET(m_fd, &errfds)) {
int zev = zt_get_event(m_fd);
if (zev)
Debug(DebugInfo,"Zapata event %d",zev);
Debug(DebugInfo,"Zapata event %d on span %d",zev,span());
}
if (FD_ISSET(m_fd, &rdfds))
runEvent(false);
@ -295,7 +295,10 @@ void ZapSource::run()
else
break;
}
Debug(m_owner,DebugAll,"ZapSource at EOF (read %d)",rd);
Debug(m_owner,DebugWarn,"ZapSource at EOF (read %d)",rd);
// TODO: find a better way of dealing with this abnormal condition
for (;;)
Thread::yield(true);
}
ZapConsumer::ZapConsumer(ZapChan *owner, const char* format, unsigned int bufsize)