From: Martin Willi Date: Tue, 2 Jul 2013 12:03:51 +0000 (+0200) Subject: watcher: add some debugging statements X-Git-Tag: 5.1.0rc1~10^2~30 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=58d0dadddc44244eb9c5e483cde6641afb54ee49;p=thirdparty%2Fstrongswan.git watcher: add some debugging statements --- diff --git a/src/libstrongswan/processing/watcher.c b/src/libstrongswan/processing/watcher.c index 928a3c05d7..ee70533962 100644 --- a/src/libstrongswan/processing/watcher.c +++ b/src/libstrongswan/processing/watcher.c @@ -250,14 +250,17 @@ static job_requeue_t watch(private_watcher_t *this) { if (entry->events & WATCHER_READ) { + DBG3(DBG_JOB, " watching %d for reading", entry->fd); FD_SET(entry->fd, &rd); } if (entry->events & WATCHER_WRITE) { + DBG3(DBG_JOB, " watching %d for writing", entry->fd); FD_SET(entry->fd, &wr); } if (entry->events & WATCHER_EXCEPT) { + DBG3(DBG_JOB, " watching %d for exceptions", entry->fd); FD_SET(entry->fd, &ex); } maxfd = max(maxfd, entry->fd); @@ -272,6 +275,7 @@ static job_requeue_t watch(private_watcher_t *this) bool old; job_t *job = NULL; + DBG2(DBG_JOB, "watcher going to select()"); thread_cleanup_push((void*)activate_all, this); old = thread_cancelability(TRUE); res = select(maxfd + 1, &rd, &wr, &ex, NULL); @@ -281,6 +285,7 @@ static job_requeue_t watch(private_watcher_t *this) { if (this->notify[0] != -1 && FD_ISSET(this->notify[0], &rd)) { + DBG2(DBG_JOB, "watcher got notification, rebuilding"); ignore_result(read(this->notify[0], buf, sizeof(buf))); return JOB_REQUEUE_DIRECT; } @@ -291,16 +296,19 @@ static job_requeue_t watch(private_watcher_t *this) { if (FD_ISSET(entry->fd, &rd)) { + DBG2(DBG_JOB, "watched FD %d ready to read", entry->fd); job = notify(this, entry, WATCHER_READ); break; } if (FD_ISSET(entry->fd, &wr)) { + DBG2(DBG_JOB, "watched FD %d ready to write", entry->fd); job = notify(this, entry, WATCHER_WRITE); break; } if (FD_ISSET(entry->fd, &ex)) { + DBG2(DBG_JOB, "watched FD %d has exception", entry->fd); job = notify(this, entry, WATCHER_EXCEPT); break; } @@ -323,6 +331,10 @@ static job_requeue_t watch(private_watcher_t *this) return JOB_REQUEUE_DIRECT; } } + else + { + DBG1(DBG_JOB, "watcher select() error: %s", strerror(errno)); + } } }