Skip to content
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 @@ -813,19 +813,25 @@ caughtException is OperationCanceledException ||
}

// Complete the operation.
if (SocketsTelemetry.Log.IsEnabled() && !_disableTelemetry) LogBytesTransferEvents(_connectSocket?.SocketType, SocketAsyncOperation.Connect, internalArgs.BytesTransferred);
if (SocketsTelemetry.Log.IsEnabled() && !_disableTelemetry)
{
LogBytesTransferEvents(_connectSocket?.SocketType, SocketAsyncOperation.Connect, internalArgs.BytesTransferred);
AfterConnectAcceptTelemetry();
}
Complete();

// If the caller is treating this operation as pending, own the completion.
// Clean up after our temporary arguments.
internalArgs.Dispose();

// If the caller is treating this operation as pending, own the completion.
if (!internalArgs.ReachedCoordinationPointFirst())
{
// Regardless of _flowExecutionContext, context will have been flown through this async method, as that's part
// of what async methods do. As such, we're already on whatever ExecutionContext is the right one to invoke
// the completion callback. This method may have even mutated the ExecutionContext, in which case for telemetry
// we need those mutations to be surfaced as part of this callback, so that logging performed here sees those
// mutations (e.g. to the current Activity).
OnCompletedInternal();
OnCompleted(this);
}
}
}
Expand Down