]> git.sur5r.net Git - bacula/bacula/commitdiff
Revert kern's r5066 -- the change caused select() + read() to spin.
authorLandon Fuller <landonf@opendarwin.org>
Mon, 10 Sep 2007 21:34:46 +0000 (21:34 +0000)
committerLandon Fuller <landonf@opendarwin.org>
Mon, 10 Sep 2007 21:34:46 +0000 (21:34 +0000)
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

index ae05e588b6789e1ac4bbc6d52ec88ceb20e437b9..71a6fa2841559c1e9432457966605bc9fcd96384 100644 (file)
@@ -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;