aboutsummaryrefslogtreecommitdiff
path: root/src/socket.cpp
diff options
context:
space:
mode:
authorMike Buland <eichlan@xagasoft.com>2009-01-19 22:07:54 +0000
committerMike Buland <eichlan@xagasoft.com>2009-01-19 22:07:54 +0000
commitb0a11f9da2cf930022411e857641eca75b5214de (patch)
tree8167ac5ba526d67c5991c1b3eef6d49f802323b2 /src/socket.cpp
parent9d099f181674ae075aa8ccaeb56acc7b732638af (diff)
downloadlibbu++-b0a11f9da2cf930022411e857641eca75b5214de.tar.gz
libbu++-b0a11f9da2cf930022411e857641eca75b5214de.tar.bz2
libbu++-b0a11f9da2cf930022411e857641eca75b5214de.tar.xz
libbu++-b0a11f9da2cf930022411e857641eca75b5214de.zip
Hey, more cases are covered for when the socket can close now.
Diffstat (limited to 'src/socket.cpp')
-rw-r--r--src/socket.cpp10
1 files changed, 10 insertions, 0 deletions
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 )
160 if( iWSAError == WSAEWOULDBLOCK ) 160 if( iWSAError == WSAEWOULDBLOCK )
161 return 0; 161 return 0;
162#else 162#else
163 if( errno == ENETRESET || errno == ECONNRESET )
164 {
165 bActive = false;
166 throw SocketException( SocketException::cClosed,
167 strerror(errno) );
168 }
163 if( errno == EAGAIN ) 169 if( errno == EAGAIN )
164 return 0; 170 return 0;
165 throw SocketException( SocketException::cRead, strerror(errno) ); 171 throw SocketException( SocketException::cRead, strerror(errno) );
@@ -356,7 +362,11 @@ bool Bu::Socket::isSeekable()
356 362
357bool Bu::Socket::isBlocking() 363bool Bu::Socket::isBlocking()
358{ 364{
365#ifndef WIN32
366 return ((fcntl( nSocket, F_GETFL, 0 ) & O_NONBLOCK) == O_NONBLOCK);
367#else
359 return false; 368 return false;
369#endif
360} 370}
361 371
362void Bu::Socket::setBlocking( bool bBlocking ) 372void Bu::Socket::setBlocking( bool bBlocking )