From bb1e4b63f06a7913529d0c41f18ad03872dee031 Mon Sep 17 00:00:00 2001 From: Thomas Ries Date: Wed, 23 Apr 2003 16:21:23 +0000 Subject: [PATCH] more debug output (MOREDEBUG) --- ChangeLog | 1 + doc/Makefile.am | 5 ++++- src/proxy.c | 2 +- src/rtpproxy.c | 12 +++++++++--- src/siproxd.c | 10 +++++----- src/sock.c | 8 +++++++- 6 files changed, 27 insertions(+), 11 deletions(-) diff --git a/ChangeLog b/ChangeLog index dd381b1..862dabb 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,6 +1,7 @@ 0.3.3 ===== 23-Apr-2003: - FAQ updates: RTP internals + - more debug and error testing (MOREDEBUG) 6-Apr-2003: - build options for FLI4L builds (libc5 & uClibc) 0.3.2 diff --git a/doc/Makefile.am b/doc/Makefile.am index bfb55b5..3e82fb4 100644 --- a/doc/Makefile.am +++ b/doc/Makefile.am @@ -19,7 +19,10 @@ # -EXTRA_DIST = siproxd.conf.example siproxd_passwd.cfg FAQ +EXTRA_DIST = siproxd.conf.example \ + siproxd_passwd.cfg \ + FAQ \ + FLI4L_HOWTO.txt install-data-local: diff --git a/src/proxy.c b/src/proxy.c index b3f84b2..5485c67 100644 --- a/src/proxy.c +++ b/src/proxy.c @@ -165,7 +165,7 @@ int proxy_request (sip_t *request) { /* if this is CANCEL/BYE request, stop RTP proxying */ if (MSG_IS_BYE(request) || MSG_IS_CANCEL(request)) { -#ifdef MODEDEBUG /*&&&&*/ +#ifdef MOREDEBUG /*&&&&*/ INFO("stopping RTP proxy stream for: %s@%s", msg_getcall_id(request)->number, msg_getcall_id(request)->host); #endif diff --git a/src/rtpproxy.c b/src/rtpproxy.c index d5a41a0..0d4b7fc 100644 --- a/src/rtpproxy.c +++ b/src/rtpproxy.c @@ -141,6 +141,9 @@ void *rtpproxy_main(void *arg) { tv.tv_usec = 0; num_fd=select(fd_max+1, &fdset, NULL, NULL, &tv); +#ifdef MOREDEBUG /*&&&&*/ +if (num_fd<0) {WARN("select() returned error [%s]",strerror(errno));} +#endif time(&t); if (configuration.rtp_proxy_enable) { @@ -159,6 +162,9 @@ void *rtpproxy_main(void *arg) { /* read from sock rtp_proxytable[i].sock*/ count=read(rtp_proxytable[i].sock, rtp_buff, RTP_BUFFER_SIZE); +#ifdef MOREDEBUG /*&&&&*/ +if (read<0) {WARN("read() returned error [%s]",strerror(errno));} +#endif /* write to dest via socket rtp_inbound*/ sipsock_send_udp(&rtp_socket, @@ -182,7 +188,7 @@ void *rtpproxy_main(void *arg) { /* time one has expired, clean it up */ callid.number=rtp_proxytable[i].callid_number; callid.host=rtp_proxytable[i].callid_host; -#ifdef MODEDEBUG /*&&&&*/ +#ifdef MOREDEBUG /*&&&&*/ INFO("RTP stream sock=%i %s@%s (idx=%i) " "has expired", rtp_proxytable[i].sock, callid.number, callid.host, i); @@ -239,7 +245,7 @@ int rtp_start_fwd (call_id_t *callid, int media_stream_no, return STS_FAILURE; } -#ifdef MODEDEBUG /*&&&&*/ +#ifdef MOREDEBUG /*&&&&*/ INFO("starting RTP proxy stream for: %s@%s #=%i", callid->number, callid->host, media_stream_no); #endif @@ -410,7 +416,7 @@ int rtp_stop_fwd (call_id_t *callid, int nolock) { return STS_FAILURE; } -#ifdef MODEDEBUG /*&&&&*/ +#ifdef MOREDEBUG /*&&&&*/ INFO("stopping RTP proxy stream for: %s@%s", callid->number, callid->host); #endif diff --git a/src/siproxd.c b/src/siproxd.c index b7f9ca8..340feed 100644 --- a/src/siproxd.c +++ b/src/siproxd.c @@ -161,17 +161,17 @@ int main (int argc, char *argv[]) #endif log_set_tosyslog(1); } -#ifdef MODEDEBUG /*&&&&*/ +#ifdef MOREDEBUG /*&&&&*/ INFO("daemonizing done (pid=%i)", getpid()); #endif /* initialize the RTP proxy thread */ -#ifdef MODEDEBUG /*&&&&*/ +#ifdef MOREDEBUG /*&&&&*/ INFO("b4 rtpproxy_init"); #endif atexit(rtpproxy_kill); /* cancel RTP thread at exit */ rtpproxy_init(); -#ifdef MODEDEBUG /*&&&&*/ +#ifdef MOREDEBUG /*&&&&*/ INFO("rtpproxy_init done"); #endif @@ -188,7 +188,7 @@ INFO("rtpproxy_init done"); ERROR("unable to bind to SIP listening socket - aborting"); exit(1); } -#ifdef MODEDEBUG /*&&&&*/ +#ifdef MOREDEBUG /*&&&&*/ INFO("sipsock_listen done"); #endif @@ -214,7 +214,7 @@ INFO("sipsock_listen done"); i=sipsock_read(&buff, sizeof(buff), &from); -#ifdef MODEDEBUG /*&&&&*/ +#ifdef MOREDEBUG /*&&&&*/ {char tmp[32]; strncpy(tmp, buff, 30); tmp[30]='\0'; diff --git a/src/sock.c b/src/sock.c index 839f94f..5c2b067 100644 --- a/src/sock.c +++ b/src/sock.c @@ -86,7 +86,10 @@ int sipsock_wait(void) { FD_ZERO(&fdset); FD_SET (listen_socket, &fdset); sts=select (listen_socket+1, &fdset, NULL, NULL, &timeout); - +#ifdef MOREDEBUG /*&&&&*/ +if (sts<0) {WARN("select() returned error [%s]",strerror(errno));} +#endif + return sts; } @@ -103,6 +106,9 @@ int sipsock_read(void *buf, size_t bufsize, struct sockaddr_in *from) { fromlen=sizeof(struct sockaddr_in); count=recvfrom(listen_socket, buf, bufsize, 0, (struct sockaddr *)from, &fromlen); +#ifdef MOREDEBUG /*&&&&*/ +if (count<0) {WARN("recvfrom() returned error [%s]",strerror(errno));} +#endif DEBUGC(DBCLASS_NET,"received UDP packet from %s, count=%i", inet_ntoa(from->sin_addr), count);