aboutsummaryrefslogtreecommitdiffstats
path: root/smtpd/ioev.c
diff options
context:
space:
mode:
authorGilles Chehade <gilles@poolp.org>2013-05-16 09:31:47 +0200
committerGilles Chehade <gilles@poolp.org>2013-05-16 09:31:47 +0200
commit005bd9030cee1b8c6e169ddbab01ff33ad4b7191 (patch)
treefe78dcdc75d70ae31a5937d76fe84a1739b8f81a /smtpd/ioev.c
parentMerge branch 'master' into portable (diff)
parentfix event handling and pauses in ssl layer to avoid possible crash (diff)
downloadOpenSMTPD-005bd9030cee1b8c6e169ddbab01ff33ad4b7191.tar.xz
OpenSMTPD-005bd9030cee1b8c6e169ddbab01ff33ad4b7191.zip
Merge branch 'master' into portable
Diffstat (limited to 'smtpd/ioev.c')
-rw-r--r--smtpd/ioev.c16
1 files changed, 11 insertions, 5 deletions
diff --git a/smtpd/ioev.c b/smtpd/ioev.c
index 984bb460..fcd24526 100644
--- a/smtpd/ioev.c
+++ b/smtpd/ioev.c
@@ -120,6 +120,7 @@ io_strevent(int evt)
switch (evt) {
CASE(IO_CONNECTED);
CASE(IO_TLSREADY);
+ CASE(IO_TLSVERIFIED);
CASE(IO_DATAIN);
CASE(IO_LOWAT);
CASE(IO_DISCONNECTED);
@@ -855,6 +856,7 @@ io_dispatch_write_ssl(int fd, short event, void *humppa)
void
io_reload_ssl(struct io *io)
{
+ short ev = EV_READ|EV_WRITE;
void (*dispatch)(int, short, void*) = NULL;
switch (io->state) {
@@ -865,19 +867,23 @@ io_reload_ssl(struct io *io)
dispatch = io_dispatch_accept_ssl;
break;
case IO_STATE_UP:
- if ((io->flags & IO_RW) == IO_READ)
+ ev = 0;
+ if (IO_READING(io) && !(io->flags & IO_PAUSE_IN)) {
+ ev = EV_READ;
dispatch = io_dispatch_read_ssl;
- else {
- if (io_queued(io) == 0)
- return; /* nothing to write */
+ }
+ else if (IO_WRITING(io) && !(io->flags & IO_PAUSE_OUT) && io_queued(io)) {
+ ev = EV_WRITE;
dispatch = io_dispatch_write_ssl;
}
+ if (! ev)
+ return; /* paused */
break;
default:
errx(1, "io_reload_ssl(): bad state");
}
- io_reset(io, EV_READ | EV_WRITE, dispatch);
+ io_reset(io, ev, dispatch);
}
#endif /* IO_SSL */