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/client.cpp | 2 ++ src/socket.cpp | 10 ++++++++++ 2 files changed, 12 insertions(+) (limited to 'src') diff --git a/src/client.cpp b/src/client.cpp index 81f2285..43d1a08 100644 --- a/src/client.cpp +++ b/src/client.cpp @@ -27,6 +27,8 @@ Bu::Client::Client( Bu::Socket *pSocket, class Bu::ClientLinkFactory *pfLink ) : Bu::Client::~Client() { + delete pSocket; + pSocket = NULL; } void Bu::Client::processInput() 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