From 30bd99d075c8f39e8865b8a5aa38105f93703206 Mon Sep 17 00:00:00 2001 From: Kern Sibbald Date: Wed, 7 Jul 2010 07:49:48 +0200 Subject: [PATCH] Fix for TLS bugs #1568 and #1599 --- bacula/src/lib/tls.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/bacula/src/lib/tls.c b/bacula/src/lib/tls.c index e67f75818e..1dd53152e0 100644 --- a/bacula/src/lib/tls.c +++ b/bacula/src/lib/tls.c @@ -637,6 +637,19 @@ static inline int openssl_bsock_readwrite(BSOCK *bsock, char *ptr, int nbytes, b } break; + case SSL_ERROR_SYSCALL: + if (nwritten == -1) { + if (errno == EINTR) { + continue; + } + if (errno == EAGAIN) { + bmicrosleep(0, 20000); /* try again in 20 ms */ + continue; + } + } + openssl_post_errors(bsock->get_jcr(), M_FATAL, _("TLS read/write failure.")); + goto cleanup; + case SSL_ERROR_WANT_READ: /* If we timeout on a select, this will be unset */ FD_SET((unsigned)bsock->m_fd, &fdset); -- 2.39.5