diff options
author | Benoit Foucher <benoit@zeroc.com> | 2016-04-27 14:33:30 +0200 |
---|---|---|
committer | Benoit Foucher <benoit@zeroc.com> | 2016-04-27 14:33:30 +0200 |
commit | c62cd6c4d50c7f762aefc76bc36bfa1e34022e72 (patch) | |
tree | c1751dc479145b27fe66ccebd56b257b2b3e04f9 /cpp/src/Ice/StreamSocket.cpp | |
parent | Added ClientPrivate.js to .gitignore (diff) | |
download | ice-c62cd6c4d50c7f762aefc76bc36bfa1e34022e72.tar.bz2 ice-c62cd6c4d50c7f762aefc76bc36bfa1e34022e72.tar.xz ice-c62cd6c4d50c7f762aefc76bc36bfa1e34022e72.zip |
Fix to no longer close the socket on fdToString failure, the caller is now closing the socket if necessary
Diffstat (limited to 'cpp/src/Ice/StreamSocket.cpp')
-rw-r--r-- | cpp/src/Ice/StreamSocket.cpp | 20 |
1 files changed, 18 insertions, 2 deletions
diff --git a/cpp/src/Ice/StreamSocket.cpp b/cpp/src/Ice/StreamSocket.cpp index e11d5709aa4..2f5cb94021f 100644 --- a/cpp/src/Ice/StreamSocket.cpp +++ b/cpp/src/Ice/StreamSocket.cpp @@ -35,7 +35,15 @@ StreamSocket::StreamSocket(const ProtocolInstancePtr& instance, _state = StateConnected; } #endif - _desc = fdToString(_fd, _proxy, _addr); + try + { + _desc = fdToString(_fd, _proxy, _addr); + } + catch(const Ice::Exception&) + { + closeSocketNoThrow(_fd); + throw; + } } StreamSocket::StreamSocket(const ProtocolInstancePtr& instance, SOCKET fd) : @@ -48,7 +56,15 @@ StreamSocket::StreamSocket(const ProtocolInstancePtr& instance, SOCKET fd) : #endif { init(); - _desc = fdToString(fd); + try + { + _desc = fdToString(fd); + } + catch(const Ice::Exception&) + { + closeSocketNoThrow(fd); + throw; + } } StreamSocket::~StreamSocket() |