From b0a11f9da2cf930022411e857641eca75b5214de Mon Sep 17 00:00:00 2001 From: Mike Buland Date: Mon, 19 Jan 2009 22:07:54 +0000 Subject: Hey, more cases are covered for when the socket can close now. --- src/socket.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'src/socket.cpp') diff --git a/src/socket.cpp b/src/socket.cpp index 3e4f3c7..c3781b0 100644 --- a/src/socket.cpp +++ b/src/socket.cpp @@ -160,6 +160,12 @@ size_t Bu::Socket::read( void *pBuf, size_t nBytes ) if( iWSAError == WSAEWOULDBLOCK ) return 0; #else + if( errno == ENETRESET || errno == ECONNRESET ) + { + bActive = false; + throw SocketException( SocketException::cClosed, + strerror(errno) ); + } if( errno == EAGAIN ) return 0; throw SocketException( SocketException::cRead, strerror(errno) ); @@ -356,7 +362,11 @@ bool Bu::Socket::isSeekable() bool Bu::Socket::isBlocking() { +#ifndef WIN32 + return ((fcntl( nSocket, F_GETFL, 0 ) & O_NONBLOCK) == O_NONBLOCK); +#else return false; +#endif } void Bu::Socket::setBlocking( bool bBlocking ) -- cgit v1.2.3