summaryrefslogtreecommitdiff
path: root/usr.sbin/ripd/ripd.c
diff options
context:
space:
mode:
authorClaudio Jeker <claudio@cvs.openbsd.org>2009-05-31 17:06:02 +0000
committerClaudio Jeker <claudio@cvs.openbsd.org>2009-05-31 17:06:02 +0000
commitd978db156467c4c8858947d5112c464eb42baf33 (patch)
treebc35bf798b2f4b41fa65cfcb1d23dafb78d8f5e0 /usr.sbin/ripd/ripd.c
parent1ff0bb2172075b54cbadc12b25239b4bd99221c8 (diff)
Better EV_READ and EV_WRITE handling in the libevent callbacks. Again mostly
the same ospfd diff applied with some fuzz.
Diffstat (limited to 'usr.sbin/ripd/ripd.c')
-rw-r--r--usr.sbin/ripd/ripd.c22
1 files changed, 7 insertions, 15 deletions
diff --git a/usr.sbin/ripd/ripd.c b/usr.sbin/ripd/ripd.c
index c6ba4964b43..5dffa43989d 100644
--- a/usr.sbin/ripd/ripd.c
+++ b/usr.sbin/ripd/ripd.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ripd.c,v 1.13 2009/03/27 14:37:25 michele Exp $ */
+/* $OpenBSD: ripd.c,v 1.14 2009/05/31 17:06:01 claudio Exp $ */
/*
* Copyright (c) 2006 Michele Marchetto <mydecay@openbeer.it>
@@ -340,20 +340,16 @@ main_dispatch_ripe(int fd, short event, void *bula)
ssize_t n;
int shut = 0;
- switch (event) {
- case EV_READ:
+ if (event & EV_READ) {
if ((n = imsg_read(ibuf)) == -1)
fatal("imsg_read error");
if (n == 0) /* connection closed */
shut = 1;
- break;
- case EV_WRITE:
+ }
+ if (event & EV_WRITE) {
if (msgbuf_write(&ibuf->w) == -1)
fatal("msgbuf_write");
imsg_event_add(ibuf);
- return;
- default:
- fatalx("unknown event");
}
for (;;) {
@@ -416,20 +412,16 @@ main_dispatch_rde(int fd, short event, void *bula)
ssize_t n;
int shut = 0;
- switch (event) {
- case EV_READ:
+ if (event & EV_READ) {
if ((n = imsg_read(ibuf)) == -1)
fatal("imsg_read error");
if (n == 0) /* connection closed */
shut = 1;
- break;
- case EV_WRITE:
+ }
+ if (event & EV_WRITE) {
if (msgbuf_write(&ibuf->w) == -1)
fatal("msgbuf_write");
imsg_event_add(ibuf);
- return;
- default:
- fatalx("unknown event");
}
for (;;) {