[sr-dev] git:kamailio_3.0: io_wait: fix kqueue io_wait_add & POLLIN

Andrei Pelinescu-Onciul andrei at iptel.org
Thu Aug 19 16:17:07 CEST 2010


Module: sip-router
Branch: kamailio_3.0
Commit: 8e6609c4416dd4f1196daa793b75c305ca22155e
URL:    http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=8e6609c4416dd4f1196daa793b75c305ca22155e

Author: Andrei Pelinescu-Onciul <andrei at iptel.org>
Committer: Andrei Pelinescu-Onciul <andrei at iptel.org>
Date:   Sat Jun 19 00:35:47 2010 +0200

io_wait: fix kqueue io_wait_add & POLLIN

A "goto error" was placed outside the error handling "if",
resulting in any io_watch_add(), that tried to enable write
watching on a new FD, returning failure (fortunately this kind
of io_watch_add() usage doesn't happen very often, usually write
watch is enabled via io_watch_chg() on FDs already
io_watch_add()'ed for reading).

Only POLL_KQUEUE was affected by this bug, meaning the default on
all *bsd and darwin.

(cherry picked from commit e5be1a067158c8ba49d33082eb403937546e7c69)

---

 io_wait.h |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/io_wait.h b/io_wait.h
index 01df1e6..b110b6b 100644
--- a/io_wait.h
+++ b/io_wait.h
@@ -499,7 +499,7 @@ again2:
 		case POLL_KQUEUE:
 			if (likely( events & POLLIN)){
 				if (unlikely(kq_ev_change(h, fd, EVFILT_READ, EV_ADD, e)==-1))
-				goto error;
+					goto error;
 			}
 			if (unlikely( events & POLLOUT)){
 				if (unlikely(kq_ev_change(h, fd, EVFILT_WRITE, EV_ADD, e)==-1))
@@ -507,8 +507,8 @@ again2:
 					if (likely(events & POLLIN)){
 						kq_ev_change(h, fd, EVFILT_READ, EV_DELETE, 0);
 					}
+					goto error;
 				}
-				goto error;
 			}
 			break;
 #endif




More information about the sr-dev mailing list