diff options
author | Benoit Foucher <benoit@zeroc.com> | 2018-03-01 14:00:39 +0100 |
---|---|---|
committer | Benoit Foucher <benoit@zeroc.com> | 2018-03-01 14:00:39 +0100 |
commit | 6a53b1575ed0f855108abc5184744c2529c151ae (patch) | |
tree | 6e9188775461599b5c83890e226da62e5f255a7f /cpp/src/Ice/StreamSocket.cpp | |
parent | Fixed JS test suite hang (ICE-8696) (diff) | |
download | ice-6a53b1575ed0f855108abc5184744c2529c151ae.tar.bz2 ice-6a53b1575ed0f855108abc5184744c2529c151ae.tar.xz ice-6a53b1575ed0f855108abc5184744c2529c151ae.zip |
Fixed UWP transport to cancel read/write operations on close (ICE-8686)
Diffstat (limited to 'cpp/src/Ice/StreamSocket.cpp')
-rwxr-xr-x | cpp/src/Ice/StreamSocket.cpp | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/cpp/src/Ice/StreamSocket.cpp b/cpp/src/Ice/StreamSocket.cpp index 274f52000f2..dd6c1a66546 100755 --- a/cpp/src/Ice/StreamSocket.cpp +++ b/cpp/src/Ice/StreamSocket.cpp @@ -18,7 +18,6 @@ using namespace IceInternal; #include <Ice/Properties.h> using namespace Platform; using namespace Windows::Foundation; - #endif StreamSocket::StreamSocket(const ProtocolInstancePtr& instance, @@ -509,8 +508,9 @@ StreamSocket::startWrite(Buffer& buf) try { queueAction(SocketOperationConnect, - safe_cast<Windows::Networking::Sockets::StreamSocket^>(_fd)->ConnectAsync(addr.host, addr.port, - Windows::Networking::Sockets::SocketProtectionLevel::PlainSocket), true); + safe_cast<Windows::Networking::Sockets::StreamSocket^>(_fd)->ConnectAsync( + addr.host, addr.port, + Windows::Networking::Sockets::SocketProtectionLevel::PlainSocket), true); } catch(Platform::Exception^ ex) { @@ -548,6 +548,7 @@ StreamSocket::startWrite(Buffer& buf) void StreamSocket::finishWrite(Buffer& buf) { + _write.operation = nullptr; // Must be cleared with the connection lock held if(_fd == INVALID_SOCKET || (_state < StateConnected && _state != StateProxyWrite)) { return; @@ -579,6 +580,7 @@ StreamSocket::startRead(Buffer& buf) void StreamSocket::finishRead(Buffer& buf) { + _read.operation = nullptr; // Must be cleared with the connection lock held if(_fd == INVALID_SOCKET) { return; @@ -615,6 +617,16 @@ StreamSocket::close() assert(_fd != INVALID_SOCKET); try { +#if defined(ICE_OS_UWP) + if(_read.operation) + { + _read.operation->Cancel(); + } + if(_write.operation) + { + _write.operation->Cancel(); + } +#endif closeSocket(_fd); _fd = INVALID_SOCKET; } |