From f587852db92f3a74f16cab04a983158f9baa2c0f Mon Sep 17 00:00:00 2001 From: Mike Buland Date: Wed, 24 Jan 2007 22:18:51 +0000 Subject: Fixed a bug? --- src/connection.cpp | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'src/connection.cpp') diff --git a/src/connection.cpp b/src/connection.cpp index cb3c724..dbf2761 100644 --- a/src/connection.cpp +++ b/src/connection.cpp @@ -228,6 +228,24 @@ int Connection::readInput() { break; } + + /* New test, if data is divisible by 2048 bytes on some libs the + * read could block, this keeps it from happening. + */ + { + fd_set rfds; + FD_ZERO(&rfds); + FD_SET(nSocket, &rfds); + int retval = select( nSocket+1, &rfds, NULL, NULL, NULL ); + if( retval == -1 ) + throw ConnectionException( + excodeBadReadError, + "Bad Read error" + ); + if( !FD_ISSET( nSocket, &rfds ) ) + break; + } + } } -- cgit v1.2.3