diff options
Diffstat (limited to 'cppe/src')
-rw-r--r-- | cppe/src/IceE/Network.cpp | 10 | ||||
-rw-r--r-- | cppe/src/IceE/Network.h | 1 | ||||
-rw-r--r-- | cppe/src/TcpTransport/Transceiver.cpp | 4 |
3 files changed, 13 insertions, 2 deletions
diff --git a/cppe/src/IceE/Network.cpp b/cppe/src/IceE/Network.cpp index eb138a38338..d083b95db70 100644 --- a/cppe/src/IceE/Network.cpp +++ b/cppe/src/IceE/Network.cpp @@ -92,6 +92,16 @@ IceInternal::wouldBlock() } bool +IceInternal::timedout() +{ +#ifdef _WIN32 + return WSAGetLastError() == WSAETIMEDOUT; +#else + return errno == EAGAIN || errno == EWOULDBLOCK; +#endif +} + +bool IceInternal::connectFailed() { #ifdef _WIN32 diff --git a/cppe/src/IceE/Network.h b/cppe/src/IceE/Network.h index 7f421e98cd5..0fdb6d23b8a 100644 --- a/cppe/src/IceE/Network.h +++ b/cppe/src/IceE/Network.h @@ -73,6 +73,7 @@ bool interrupted(); bool acceptInterrupted(); bool noBuffers(); bool wouldBlock(); +bool timedout(); bool connectFailed(); bool connectionRefused(); bool connectInProgress(); diff --git a/cppe/src/TcpTransport/Transceiver.cpp b/cppe/src/TcpTransport/Transceiver.cpp index 596d4c3da8c..f3bb4715748 100644 --- a/cppe/src/TcpTransport/Transceiver.cpp +++ b/cppe/src/TcpTransport/Transceiver.cpp @@ -142,7 +142,7 @@ IceInternal::Transceiver::write(Buffer& buf, int timeout) } #ifndef ICEE_USE_SELECT_FOR_TIMEOUTS - if(wouldBlock()) + if(timedout()) { throw TimeoutException(__FILE__, __LINE__); } @@ -255,7 +255,7 @@ IceInternal::Transceiver::read(Buffer& buf, int timeout) } #ifndef ICEE_USE_SELECT_FOR_TIMEOUTS - if(wouldBlock()) + if(timedout()) { throw TimeoutException(__FILE__, __LINE__); } |