From 7feda496e89edf6c18ae8571c992db7b185e7eb8 Mon Sep 17 00:00:00 2001 From: Kern Sibbald Date: Sat, 21 Nov 2009 20:28:39 +0100 Subject: [PATCH] Attempt to keep tls_shutdown from hanging --- bacula/src/lib/tls.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/bacula/src/lib/tls.c b/bacula/src/lib/tls.c index f5f0623a3c..62a1ecf108 100644 --- a/bacula/src/lib/tls.c +++ b/bacula/src/lib/tls.c @@ -558,15 +558,22 @@ void tls_bsock_shutdown(BSOCK *bsock) */ int err; + btimer_t *tid; + /* Set socket blocking for shutdown */ bsock->set_blocking(); + tid = start_bsock_timer(bsock, 60 * 2); err = SSL_shutdown(bsock->tls->openssl); + stop_bsock_timer(tid); if (err == 0) { /* Complete shutdown */ + tid = start_bsock_timer(bsock, 60 * 2); err = SSL_shutdown(bsock->tls->openssl); + stop_bsock_timer(tid); } + switch (SSL_get_error(bsock->tls->openssl, err)) { case SSL_ERROR_NONE: break; -- 2.39.5