Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[release/5.0] Fix regression in SocketAsyncContext.Unix (sequential processing of reads & writes) #46745

Merged
merged 1 commit into from
Feb 11, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -844,7 +844,7 @@ public bool StartAsyncOperation(SocketAsyncContext context, TOperation operation
}
}

public AsyncOperation? ProcessSyncEventOrGetAsyncEvent(SocketAsyncContext context, bool skipAsyncEvents = false, bool processAsyncEvents = true)
public AsyncOperation? ProcessSyncEventOrGetAsyncEvent(SocketAsyncContext context, bool skipAsyncEvents = false)
{
AsyncOperation op;
using (Lock())
Expand All @@ -865,7 +865,6 @@ public bool StartAsyncOperation(SocketAsyncContext context, TOperation operation
Debug.Assert(_isNextOperationSynchronous == (op.Event != null));
if (skipAsyncEvents && !_isNextOperationSynchronous)
{
Debug.Assert(!processAsyncEvents);
// Return the operation to indicate that the async operation was not processed, without making
// any state changes because async operations are being skipped
return op;
Expand Down Expand Up @@ -903,11 +902,6 @@ public bool StartAsyncOperation(SocketAsyncContext context, TOperation operation
{
// Async operation. The caller will figure out how to process the IO.
Debug.Assert(!skipAsyncEvents);
if (processAsyncEvents)
{
op.Process();
return null;
}
return op;
}
}
Expand Down Expand Up @@ -2079,12 +2073,14 @@ public void HandleEventsInline(Interop.Sys.SocketEvents events)

if ((events & Interop.Sys.SocketEvents.Read) != 0)
{
_receiveQueue.ProcessSyncEventOrGetAsyncEvent(this, processAsyncEvents: true);
AsyncOperation? receiveOperation = _receiveQueue.ProcessSyncEventOrGetAsyncEvent(this);
receiveOperation?.Process();
}

if ((events & Interop.Sys.SocketEvents.Write) != 0)
{
_sendQueue.ProcessSyncEventOrGetAsyncEvent(this, processAsyncEvents: true);
AsyncOperation? sendOperation = _sendQueue.ProcessSyncEventOrGetAsyncEvent(this);
sendOperation?.Process();
}
}

Expand Down