commit 40df5a7: [Fix] Various fixes to SSL state machine handler
Vsevolod Stakhov
vsevolod at highsecure.ru
Sun Jul 21 08:56:08 UTC 2019
Author: Vsevolod Stakhov
Date: 2019-07-21 09:54:43 +0100
URL: https://github.com/rspamd/rspamd/commit/40df5a7d2c66ee42daba6f98afc07cbb3f3223e5
[Fix] Various fixes to SSL state machine handler
---
src/libutil/ssl_util.c | 15 ++++++++++++++-
1 file changed, 14 insertions(+), 1 deletion(-)
diff --git a/src/libutil/ssl_util.c b/src/libutil/ssl_util.c
index 54322918c..f26bd063a 100644
--- a/src/libutil/ssl_util.c
+++ b/src/libutil/ssl_util.c
@@ -408,8 +408,17 @@ rspamd_ssl_event_handler (gint fd, short what, gpointer ud)
if (what == EV_TIMER) {
c->shut = ssl_shut_unclean;
+ rspamd_ev_watcher_stop (c->event_loop, c->ev);
+ g_set_error (&err, rspamd_ssl_quark (), ETIMEDOUT,
+ "ssl connection timed out");
+ c->err_handler (c->handler_data, err);
+ g_error_free (err);
+
+ return;
}
+ msg_debug ("ssl event; what=%d; c->state=%d", (int)what, (int)c->state);
+
switch (c->state) {
case ssl_conn_init:
/* Continue connection */
@@ -453,6 +462,10 @@ rspamd_ssl_event_handler (gint fd, short what, gpointer ud)
c->handler (fd, EV_READ, c->handler_data);
break;
case ssl_next_write:
+ rspamd_ev_watcher_reschedule (c->event_loop, c->ev, EV_WRITE);
+ c->state = ssl_conn_connected;
+ c->handler (fd, EV_WRITE, c->handler_data);
+ break;
case ssl_conn_connected:
rspamd_ev_watcher_reschedule (c->event_loop, c->ev, what);
c->state = ssl_conn_connected;
@@ -697,7 +710,7 @@ gssize
rspamd_ssl_writev (struct rspamd_ssl_connection *conn, struct iovec *iov,
gsize iovlen)
{
- static guchar ssl_buf[16000];
+ guchar ssl_buf[16000];
guchar *p;
struct iovec *cur;
guint i, remain;
More information about the Commits
mailing list