diff options
author | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2019-11-03 14:33:42 +0000 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2019-11-03 14:33:42 +0000 |
commit | c6db379233b0f15ba68f93286aea194b7ca5d4b6 (patch) | |
tree | b5c68a2fb5270f235630d3e8707078c6c13e5f50 | |
parent | 2a2e89c1534eb378892633c15a1ef955ef435a61 (diff) | |
download | rspamd-c6db379233b0f15ba68f93286aea194b7ca5d4b6.tar.gz rspamd-c6db379233b0f15ba68f93286aea194b7ca5d4b6.zip |
[Minor] One more thing about ssl_shutdown
-rw-r--r-- | src/libutil/ssl_util.c | 20 |
1 files changed, 13 insertions, 7 deletions
diff --git a/src/libutil/ssl_util.c b/src/libutil/ssl_util.c index b65243989..d145e4f5b 100644 --- a/src/libutil/ssl_util.c +++ b/src/libutil/ssl_util.c @@ -492,13 +492,18 @@ rspamd_ssl_shutdown (struct rspamd_ssl_connection *conn) /* BUGON: but we DO NOT own conn->ev, and it's a big issue */ static const ev_tstamp shutdown_time = 5.0; - rspamd_ev_watcher_stop (conn->event_loop, conn->ev); - conn->shut_ev = g_malloc0 (sizeof (*conn->shut_ev)); - rspamd_ev_watcher_init (conn->shut_ev, conn->fd, what, - rspamd_ssl_event_handler, conn); - rspamd_ev_watcher_start (conn->event_loop, conn->shut_ev, shutdown_time); - /* XXX: can it be done safely ? */ - conn->ev = conn->shut_ev; + if (conn->shut_ev == NULL) { + rspamd_ev_watcher_stop (conn->event_loop, conn->ev); + conn->shut_ev = g_malloc0 (sizeof (*conn->shut_ev)); + rspamd_ev_watcher_init (conn->shut_ev, conn->fd, what, + rspamd_ssl_event_handler, conn); + rspamd_ev_watcher_start (conn->event_loop, conn->shut_ev, shutdown_time); + /* XXX: can it be done safely ? */ + conn->ev = conn->shut_ev; + } + else { + rspamd_ev_watcher_reschedule (conn->event_loop, conn->shut_ev, what); + } conn->state = ssl_next_shutdown; } @@ -900,6 +905,7 @@ rspamd_ssl_connection_free (struct rspamd_ssl_connection *conn) if (conn->shut == ssl_shut_unclean) { /* Ignore return result and close socket */ msg_debug_ssl ("unclean shutdown"); + SSL_set_quiet_shutdown (conn->ssl, 1); (void)SSL_shutdown (conn->ssl); rspamd_ssl_connection_dtor (conn); } |