diff options
author | Marc Laukien <marc@zeroc.com> | 2004-03-29 23:21:40 +0000 |
---|---|---|
committer | Marc Laukien <marc@zeroc.com> | 2004-03-29 23:21:40 +0000 |
commit | 64c22bc624d13bec6e9e88fc6411c0d465bb47db (patch) | |
tree | 69d4a68e52cab893fc5763a92f21e87bc9ffd58d /cpp/src/Ice/Network.cpp | |
parent | *** empty log message *** (diff) | |
download | ice-64c22bc624d13bec6e9e88fc6411c0d465bb47db.tar.bz2 ice-64c22bc624d13bec6e9e88fc6411c0d465bb47db.tar.xz ice-64c22bc624d13bec6e9e88fc6411c0d465bb47db.zip |
ConnectionRefusedException
Diffstat (limited to 'cpp/src/Ice/Network.cpp')
-rw-r--r-- | cpp/src/Ice/Network.cpp | 27 |
1 files changed, 25 insertions, 2 deletions
diff --git a/cpp/src/Ice/Network.cpp b/cpp/src/Ice/Network.cpp index 3512f7e0633..2924f8aeee4 100644 --- a/cpp/src/Ice/Network.cpp +++ b/cpp/src/Ice/Network.cpp @@ -101,6 +101,17 @@ IceInternal::connectFailed() } bool +IceInternal::connectionRefused() +{ +#ifdef _WIN32 + int error = WSAGetLastError(); + return error == WSAECONNREFUSED; +#else + return errno == ECONNREFUSED; +#endif +} + +bool IceInternal::connectInProgress() { #ifdef _WIN32 @@ -484,7 +495,13 @@ repeatConnect: #else errno = val; #endif - if(connectFailed()) + if(connectionRefused()) + { + ConnectionRefusedException ex(__FILE__, __LINE__); + ex.error = getSocketErrno(); + throw ex; + } + else if(connectFailed()) { ConnectFailedException ex(__FILE__, __LINE__); ex.error = getSocketErrno(); @@ -502,7 +519,13 @@ repeatConnect: } closeSocket(fd); - if(connectFailed()) + if(connectionRefused()) + { + ConnectionRefusedException ex(__FILE__, __LINE__); + ex.error = getSocketErrno(); + throw ex; + } + else if(connectFailed()) { ConnectFailedException ex(__FILE__, __LINE__); ex.error = getSocketErrno(); |