diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/connection.cpp | 18 |
1 files changed, 18 insertions, 0 deletions
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() | |||
228 | { | 228 | { |
229 | break; | 229 | break; |
230 | } | 230 | } |
231 | |||
232 | /* New test, if data is divisible by 2048 bytes on some libs the | ||
233 | * read could block, this keeps it from happening. | ||
234 | */ | ||
235 | { | ||
236 | fd_set rfds; | ||
237 | FD_ZERO(&rfds); | ||
238 | FD_SET(nSocket, &rfds); | ||
239 | int retval = select( nSocket+1, &rfds, NULL, NULL, NULL ); | ||
240 | if( retval == -1 ) | ||
241 | throw ConnectionException( | ||
242 | excodeBadReadError, | ||
243 | "Bad Read error" | ||
244 | ); | ||
245 | if( !FD_ISSET( nSocket, &rfds ) ) | ||
246 | break; | ||
247 | } | ||
248 | |||
231 | } | 249 | } |
232 | } | 250 | } |
233 | 251 | ||