diff options
author | Jose <jose@zeroc.com> | 2018-02-22 14:00:25 +0100 |
---|---|---|
committer | Jose <jose@zeroc.com> | 2018-02-22 14:00:25 +0100 |
commit | 1d32ae18f5c9fa18560ee9cec9b921bd96b4bf3e (patch) | |
tree | e14937531f49cde31c16cc521d40e1cac025f804 /cpp/src/Ice/UdpTransceiver.cpp | |
parent | UWP crash if udp send completes after transceiver is close (diff) | |
download | ice-1d32ae18f5c9fa18560ee9cec9b921bd96b4bf3e.tar.bz2 ice-1d32ae18f5c9fa18560ee9cec9b921bd96b4bf3e.tar.xz ice-1d32ae18f5c9fa18560ee9cec9b921bd96b4bf3e.zip |
Fix UWP async operation status checks
Diffstat (limited to 'cpp/src/Ice/UdpTransceiver.cpp')
-rwxr-xr-x | cpp/src/Ice/UdpTransceiver.cpp | 15 |
1 files changed, 2 insertions, 13 deletions
diff --git a/cpp/src/Ice/UdpTransceiver.cpp b/cpp/src/Ice/UdpTransceiver.cpp index b2c29a95676..64c2a756bc1 100755 --- a/cpp/src/Ice/UdpTransceiver.cpp +++ b/cpp/src/Ice/UdpTransceiver.cpp @@ -370,7 +370,7 @@ IceInternal::UdpTransceiver::startWrite(Buffer& buf) if(!multicast) { auto operation = safe_cast<DatagramSocket^>(_fd)->ConnectAsync(_addr.host, _addr.port); - if(!checkIfErrorOrCompleted(SocketOperationConnect, operation)) + if(!checkIfErrorOrCompleted(SocketOperationConnect, operation, operation->Status)) { operation->Completed = ref new AsyncActionCompletedHandler( [this] (IAsyncAction^ info, Windows::Foundation::AsyncStatus status) @@ -392,7 +392,7 @@ IceInternal::UdpTransceiver::startWrite(Buffer& buf) else { auto operation = safe_cast<DatagramSocket^>(_fd)->GetOutputStreamAsync(_addr.host, _addr.port); - if(!checkIfErrorOrCompleted(SocketOperationConnect, operation)) + if(!checkIfErrorOrCompleted(SocketOperationConnect, operation, operation->Status)) { operation->Completed = ref new AsyncOperationCompletedHandler<IOutputStream^>( [=](IAsyncOperation<IOutputStream^>^ info, Windows::Foundation::AsyncStatus status) @@ -550,17 +550,6 @@ IceInternal::UdpTransceiver::getOutputStreamCompleted(concurrency::task<IOutputS DataWriter^ writer = ref new DataWriter(task.get()); writer->WriteBytes(ref new Array<unsigned char>(&*buf.i, static_cast<int>(buf.b.size()))); DataWriterStoreOperation^ operation = writer->StoreAsync(); - if(operation->Status == Windows::Foundation::AsyncStatus::Completed) - { - // - // NOTE: unlike other methods, it's important to modify _write.count - // _before_ calling checkIfErrorOrCompleted since this isn't called - // with the connection mutex but from a Windows thread pool thread. - // So we can't modify the _write structure after calling the - // completed callback. - // - _write.count = operation->GetResults(); - } queueOperation(SocketOperationWrite, operation); } catch(Platform::Exception^ pex) |