Commit 003aa073 authored by Marc Gravell's avatar Marc Gravell

fix break to count of sync completions from MatchResult

parent 75208257
...@@ -8,6 +8,9 @@ internal static class CompletionManagerHelpers ...@@ -8,6 +8,9 @@ internal static class CompletionManagerHelpers
public static void CompleteSyncOrAsync(this PhysicalBridge bridge, ICompletable operation) public static void CompleteSyncOrAsync(this PhysicalBridge bridge, ICompletable operation)
=> CompletionManager.CompleteSyncOrAsyncImpl(bridge?.completionManager, operation); => CompletionManager.CompleteSyncOrAsyncImpl(bridge?.completionManager, operation);
public static void IncrementSyncCount(this PhysicalBridge bridge)
=> bridge?.completionManager?.IncrementSyncCount();
public static void CompleteAsync(this PhysicalBridge bridge, ICompletable operation) public static void CompleteAsync(this PhysicalBridge bridge, ICompletable operation)
=> CompletionManager.CompleteAsync(bridge?.completionManager, operation); => CompletionManager.CompleteAsync(bridge?.completionManager, operation);
...@@ -23,6 +26,8 @@ internal static void CompleteSyncOrAsyncImpl(CompletionManager manager, IComplet ...@@ -23,6 +26,8 @@ internal static void CompleteSyncOrAsyncImpl(CompletionManager manager, IComplet
else SharedCompleteSyncOrAsync(operation); else SharedCompleteSyncOrAsync(operation);
} }
internal void IncrementSyncCount() => Interlocked.Increment(ref completedSync);
internal static void CompleteAsync(CompletionManager manager, ICompletable operation) internal static void CompleteAsync(CompletionManager manager, ICompletable operation)
{ {
var sched = manager.multiplexer.SocketManager; var sched = manager.multiplexer.SocketManager;
......
...@@ -1276,10 +1276,18 @@ private void MatchResult(RawResult result) ...@@ -1276,10 +1276,18 @@ private void MatchResult(RawResult result)
} }
Trace("Response to: " + msg); Trace("Response to: " + msg);
if (msg.ComputeResult(this, result) && !msg.TryComplete(false)) if (msg.ComputeResult(this, result))
{ // got a result, and we couldn't complete it synchronously; {
// note that we want to complete it async instead if (msg.TryComplete(false))
BridgeCouldBeNull.CompleteAsync(msg); {
BridgeCouldBeNull.IncrementSyncCount();
}
else
{
// got a result, and we couldn't complete it synchronously;
// note that we want to complete it async instead
BridgeCouldBeNull.CompleteAsync(msg);
}
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment