]> git.sur5r.net Git - bacula/bacula/commitdiff
Attempt to keep tls_shutdown from hanging
authorKern Sibbald <kern@sibbald.com>
Sat, 21 Nov 2009 19:28:39 +0000 (20:28 +0100)
committerKern Sibbald <kern@sibbald.com>
Sat, 21 Nov 2009 19:28:39 +0000 (20:28 +0100)
bacula/src/lib/tls.c

index f5f0623a3cd1bebbf598c3e068bc08d5ac00180c..62a1ecf1082a21d5759a29238eb3d52f1fdf7665 100644 (file)
@@ -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;