Skip to content

Commit

Permalink
Fix C# connection to correctly mark message as sent (#3072)
Browse files Browse the repository at this point in the history
  • Loading branch information
pepone authored Nov 6, 2024
1 parent 4bf5007 commit b3e5b20
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 b3e5b20

Please sign in to comment.