From: Landon Fuller Date: Mon, 10 Sep 2007 21:34:46 +0000 (+0000) Subject: Revert kern's r5066 -- the change caused select() + read() to spin. X-Git-Tag: Release-7.0.0~5700 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=d3534e9da17d7dea74e8c4d44bd3f9f3bc8ebda6;p=bacula%2Fbacula 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 --- 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;