commit c6db379: [Minor] One more thing about ssl_shutdown
Vsevolod Stakhov
vsevolod at highsecure.ru
Sun Nov 3 14:35:07 UTC 2019
Author: Vsevolod Stakhov
Date: 2019-11-03 14:33:42 +0000
URL: https://github.com/rspamd/rspamd/commit/c6db379233b0f15ba68f93286aea194b7ca5d4b6 (HEAD -> master)
[Minor] One more thing about ssl_shutdown
---
src/libutil/ssl_util.c | 20 +++++++++++++-------
1 file 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);
}
More information about the Commits
mailing list