summaryrefslogtreecommitdiff
path: root/src/socket.cpp
diff options
context:
space:
mode:
authorMike Buland <eichlan@xagasoft.com>2009-07-29 19:01:02 +0000
committerMike Buland <eichlan@xagasoft.com>2009-07-29 19:01:02 +0000
commitc2292209eb4ece185f555a5c7823726794fe34cc (patch)
tree3bad472400717626400238c24057caacb325aac1 /src/socket.cpp
parentff5688b09c21242c2a0bee70cdfd1ea50b06f4f0 (diff)
downloadlibbu++-c2292209eb4ece185f555a5c7823726794fe34cc.tar.gz
libbu++-c2292209eb4ece185f555a5c7823726794fe34cc.tar.bz2
libbu++-c2292209eb4ece185f555a5c7823726794fe34cc.tar.xz
libbu++-c2292209eb4ece185f555a5c7823726794fe34cc.zip
Wow, socket, as it turned out, was not able to close after the remote end
disconnected. It now automatically closes down the local end when the remote end dies.
Diffstat (limited to 'src/socket.cpp')
-rw-r--r--src/socket.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/socket.cpp b/src/socket.cpp
index 46e6cd7..3ddc492 100644
--- a/src/socket.cpp
+++ b/src/socket.cpp
@@ -159,7 +159,7 @@ size_t Bu::Socket::read( void *pBuf, size_t nBytes )
159 bu_recv( nSocket, (char *) pBuf, nBytes, 0 ) ); 159 bu_recv( nSocket, (char *) pBuf, nBytes, 0 ) );
160 if( nRead == 0 ) 160 if( nRead == 0 )
161 { 161 {
162 bActive = false; 162 close();
163 throw SocketException( SocketException::cClosed, "Socket closed."); 163 throw SocketException( SocketException::cClosed, "Socket closed.");
164 } 164 }
165 if( nRead < 0 ) 165 if( nRead < 0 )
@@ -171,7 +171,7 @@ size_t Bu::Socket::read( void *pBuf, size_t nBytes )
171#else 171#else
172 if( errno == ENETRESET || errno == ECONNRESET ) 172 if( errno == ENETRESET || errno == ECONNRESET )
173 { 173 {
174 bActive = false; 174 close();
175 throw SocketException( SocketException::cClosed, 175 throw SocketException( SocketException::cClosed,
176 strerror(errno) ); 176 strerror(errno) );
177 } 177 }