From d3534e9da17d7dea74e8c4d44bd3f9f3bc8ebda6 Mon Sep 17 00:00:00 2001 From: Landon Fuller Date: Mon, 10 Sep 2007 21:34:46 +0000 Subject: [PATCH] Revert kern's r5066 -- the change caused select() + read() to spin. We need to check for readability and writability seperately, based on what OpenSSL requests. git-svn-id: https://bacula.svn.sourceforge.net/svnroot/bacula/trunk@5522 91ce42f0-d328-0410-95d8-f526ca767f89 --- bacula/src/lib/tls.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/bacula/src/lib/tls.c b/bacula/src/lib/tls.c index ae05e588b6..71a6fa2841 100644 --- a/bacula/src/lib/tls.c +++ b/bacula/src/lib/tls.c @@ -622,12 +622,20 @@ static inline int openssl_bsock_readwrite(BSOCK *bsock, char *ptr, int nbytes, b break; case SSL_ERROR_WANT_READ: + /* If we timeout on a select, this will be unset */ + FD_SET((unsigned)bsock->m_fd, &fdset); + tv.tv_sec = 10; + tv.tv_usec = 0; + /* Block until we can read */ + select(fdmax, &fdset, NULL, NULL, &tv); + break; + case SSL_ERROR_WANT_WRITE: /* If we timeout on a select, this will be unset */ FD_SET((unsigned)bsock->m_fd, &fdset); tv.tv_sec = 10; tv.tv_usec = 0; - /* Block until we can read or write */ + /* Block until we can write */ select(fdmax, NULL, &fdset, NULL, &tv); break; -- 2.39.5