diff options
author | Benoit Foucher <benoit@zeroc.com> | 2012-11-22 19:02:30 +0100 |
---|---|---|
committer | Benoit Foucher <benoit@zeroc.com> | 2012-11-22 19:02:30 +0100 |
commit | b4400eb6446d585b775f34833619a15f6d88ad0d (patch) | |
tree | f09be78b163d920d7335883316ebb6228c564781 /cpp/src/Ice/UdpTransceiver.cpp | |
parent | Fixed ICE-4982 and ICE-4985: WinRT Udp test failures (diff) | |
download | ice-b4400eb6446d585b775f34833619a15f6d88ad0d.tar.bz2 ice-b4400eb6446d585b775f34833619a15f6d88ad0d.tar.xz ice-b4400eb6446d585b775f34833619a15f6d88ad0d.zip |
ICE-4982: correct fix for the UDP assert
Diffstat (limited to 'cpp/src/Ice/UdpTransceiver.cpp')
-rw-r--r-- | cpp/src/Ice/UdpTransceiver.cpp | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/cpp/src/Ice/UdpTransceiver.cpp b/cpp/src/Ice/UdpTransceiver.cpp index 1147d6c45ce..60416db2311 100644 --- a/cpp/src/Ice/UdpTransceiver.cpp +++ b/cpp/src/Ice/UdpTransceiver.cpp @@ -446,12 +446,20 @@ IceInternal::UdpTransceiver::startWrite(Buffer& buf) 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(checkIfErrorOrCompleted(SocketOperationWrite, operation)) + + 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(); - _completedHandler(SocketOperationWrite); } - else + + if(!checkIfErrorOrCompleted(SocketOperationWrite, operation)) { operation->Completed = _writeOperationCompletedHandler; } |