diff options
author | Benoit Foucher <benoit@zeroc.com> | 2006-02-20 11:15:21 +0000 |
---|---|---|
committer | Benoit Foucher <benoit@zeroc.com> | 2006-02-20 11:15:21 +0000 |
commit | c88fa86645b82d2beea6e98f139d46063b59910a (patch) | |
tree | 552ed35ccbc73aceb265212e6cba3a35540b97b9 /cppe/src | |
parent | Win32 fix for socket timeouts. (diff) | |
download | ice-c88fa86645b82d2beea6e98f139d46063b59910a.tar.bz2 ice-c88fa86645b82d2beea6e98f139d46063b59910a.tar.xz ice-c88fa86645b82d2beea6e98f139d46063b59910a.zip |
More Win32 socket timeout fixes
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__); } |