diff options
author | Kenneth R Westerback <krw@cvs.openbsd.org> | 2017-08-09 19:57:55 +0000 |
---|---|---|
committer | Kenneth R Westerback <krw@cvs.openbsd.org> | 2017-08-09 19:57:55 +0000 |
commit | 20dbc48a615f5247f4a1686e516003284634dcfb (patch) | |
tree | 3e66165f344fda2044b5c3a6232a4daac23ea627 /sbin/dhclient/dispatch.c | |
parent | 4fecec7642d3cef00e1cbe278b6ce9993a65515e (diff) |
Stop obsessively flushing the imsg connection. Just
flush any queued messages on getting a POLLOUT.
Diffstat (limited to 'sbin/dhclient/dispatch.c')
-rw-r--r-- | sbin/dhclient/dispatch.c | 24 |
1 files changed, 21 insertions, 3 deletions
diff --git a/sbin/dhclient/dispatch.c b/sbin/dhclient/dispatch.c index 08d4d2b7a49..f7792c86cde 100644 --- a/sbin/dhclient/dispatch.c +++ b/sbin/dhclient/dispatch.c @@ -1,4 +1,4 @@ -/* $OpenBSD: dispatch.c,v 1.136 2017/08/09 19:35:59 krw Exp $ */ +/* $OpenBSD: dispatch.c,v 1.137 2017/08/09 19:57:54 krw Exp $ */ /* * Copyright 2004 Henning Brauer <henning@openbsd.org> @@ -71,6 +71,7 @@ void packethandler(struct interface_info *ifi); +void flush_unpriv_ibuf(const char *); /* * Loop waiting for packets, timeouts or routing messages. @@ -299,6 +300,25 @@ packethandler(struct interface_info *ifi) free(info); } +/* + * flush_unpriv_ibuf stuffs queued messages into the imsg socket. + */ +void +flush_unpriv_ibuf(const char *who) +{ + while (unpriv_ibuf->w.queued) { + if (msgbuf_write(&unpriv_ibuf->w) <= 0) { + if (errno == EAGAIN) + break; + if (quit == 0) + quit = INTERNALSIG; + if (errno != EPIPE && errno != 0) + log_warn("%s: msgbuf_write", who); + break; + } + } +} + void set_timeout(struct interface_info *ifi, time_t secs, void (*where)(struct interface_info *)) @@ -326,6 +346,4 @@ sendhup(void) rslt = imsg_compose(unpriv_ibuf, IMSG_HUP, 0, 0, -1, NULL, 0); if (rslt == -1) log_warn("sendhup: imsg_compose"); - - flush_unpriv_ibuf("sendhup"); } |