diff options
author | 2017-01-23 09:09:15 +0000 | |
---|---|---|
committer | 2017-01-23 09:09:15 +0000 | |
commit | 4d78e8aeee81b43e0cba56e79a3ef7b5b8e2e20f (patch) | |
tree | 5a870d447d2d8f37ca1416dca2c9bb582f459c76 | |
parent | Kill unecessary splsoftnet()/splx() dances, what's protecting radix (diff) | |
download | wireguard-openbsd-4d78e8aeee81b43e0cba56e79a3ef7b5b8e2e20f.tar.xz wireguard-openbsd-4d78e8aeee81b43e0cba56e79a3ef7b5b8e2e20f.zip |
Switch spamd to nonblocking descriptors so we can count on getting a
short write when the socket buffers are full, instead of blocking.
ok benno@ claudio@
-rw-r--r-- | libexec/spamd/spamd.c | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/libexec/spamd/spamd.c b/libexec/spamd/spamd.c index 22acebf2072..6f33b33084c 100644 --- a/libexec/spamd/spamd.c +++ b/libexec/spamd/spamd.c @@ -1,4 +1,4 @@ -/* $OpenBSD: spamd.c,v 1.148 2017/01/17 23:28:04 mestre Exp $ */ +/* $OpenBSD: spamd.c,v 1.149 2017/01/23 09:09:15 beck Exp $ */ /* * Copyright (c) 2015 Henning Brauer <henning@openbsd.org> @@ -1099,6 +1099,8 @@ handler(struct con *cp) if (n == 0) closecon(cp); + if (errno == EAGAIN) + return; else if (n == -1) { if (debug > 0) warn("read"); @@ -1153,6 +1155,8 @@ handlew(struct con *cp, int one) closecon(cp); goto handled; } else if (n == -1) { + if (errno == EAGAIN) + return; if (debug > 0 && errno != EPIPE) warn("write"); closecon(cp); @@ -1179,6 +1183,8 @@ handlew(struct con *cp, int one) if (n == 0) closecon(cp); else if (n == -1) { + if (errno == EAGAIN) + return; if (debug > 0 && errno != EPIPE) warn("write"); closecon(cp); @@ -1665,7 +1671,8 @@ jail: int s2; sinlen = sizeof(sin); - s2 = accept(smtplisten, (struct sockaddr *)&sin, &sinlen); + s2 = accept4(smtplisten, (struct sockaddr *)&sin, &sinlen, + SOCK_NONBLOCK); if (s2 == -1) { switch (errno) { case EINTR: |