Skip to content

Commit

Permalink
Fix C# connection to correctly mark message as sent
Browse files Browse the repository at this point in the history
  • Loading branch information
pepone committed Nov 5, 2024
1 parent 0d200bf commit fba6852
Showing 1 changed file with 16 additions and 8 deletions.
24 changes: 16 additions & 8 deletions csharp/src/Ice/ConnectionI.cs
Original file line number Diff line number Diff line change
Expand Up @@ -607,15 +607,23 @@ public override bool startAsync(int operation, Ice.Internal.AsyncCallback comple
observerStartWrite(_writeStream.getBuffer());
}
bool completed;
if (_transceiver.startWrite(_writeStream.getBuffer(), completedCallback, this, out completed))
bool messageWritten = false;
bool completedSynchronously =
_transceiver.startWrite(
_writeStream.getBuffer(),
completedCallback,
this,
out messageWritten);
// If the startWrite call consumed the complete buffer, we assume the message is sent now for
// at-most-once semantics.
if (messageWritten && _sendStreams.Count > 0)
{
// If the write completed immediately and the buffer
if (completed && _sendStreams.Count > 0)
{
// The whole message is written, assume it's sent now for at-most-once semantics.
_sendStreams.First.Value.isSent = true;
}
_sendStreams.First.Value.isSent = true;
}
if (completedSynchronously)
{
// If the write completed synchronously, we need to call the completedCallback.
completedCallback(this);
}
}
Expand Down

0 comments on commit fba6852

Please sign in to comment.