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-3.0.0~2548 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=7d05b61b9e62ed60f6283ac960bf2a4a16cf0361;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;