bincimap

Log | Files | Refs | LICENSE

commit b132541c8ee27dcf7fa6d6276a7262c5099acd2d
parent fcc3825543cf4b4133f32f55f895c1a0d72118fd
Author: andreaha <andreaha@b31fe1f4-c0d1-0310-8000-a34f4ae90293>
Date:   Tue,  3 Feb 2004 18:34:19 +0000

- Only select on stdin if the SSL buffer is empty.


git-svn-id: file:///home/cwright/convert/bincimap/trunk@27 b31fe1f4-c0d1-0310-8000-a34f4ae90293

Diffstat:
Msrc/io-ssl.cc | 20+++++++++++---------
1 file changed, 11 insertions(+), 9 deletions(-)

diff --git a/src/io-ssl.cc b/src/io-ssl.cc @@ -267,17 +267,19 @@ int SSLEnabledIO::fillBuffer(int timeout, bool retry) tv.tv_sec = timeout; tv.tv_usec = 0; - int r = ::select(fileno(stdin) + 1, &rfds, 0, 0, timeout ? &tv : 0); - if (r == 0) { - setLastError("Reading from client timed out."); - return -2; - } + if (pending() == 0) { + int r = ::select(fileno(stdin) + 1, &rfds, 0, 0, timeout ? &tv : 0); + if (r == 0) { + setLastError("Reading from client timed out."); + return -2; + } - if (r < 0) { - setLastError("Error when reading from client"); - return -1; + if (r < 0) { + setLastError("Error when reading from client"); + return -1; + } } - + char buf[1024]; unsigned int readBytes = SSL_read(ssl, buf, sizeof(buf)); if (readBytes > 0) {