Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 5.6k
fix SendTo with SocketAsyncEventArgs#98134
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
Uh oh!
There was an error while loading. Please reload this page.
Changes from all commits
50ac1c69b1a4a9dc1453ee95b2fb412b66f27ce02fFile filter
Filter by extension
Conversations
Uh oh!
There was an error while loading. Please reload this page.
Jump to
Uh oh!
There was an error while loading. Please reload this page.
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -923,7 +923,12 @@ internal void FinishOperationSyncSuccess(int bytesTransferred, SocketFlags flags | ||
| case SocketAsyncOperation.ReceiveFrom: | ||
| // Deal with incoming address. | ||
| UpdateReceivedSocketAddress(_socketAddress!); | ||
| if (_remoteEndPoint != null && !SocketAddressExtensions.Equals(_socketAddress!, _remoteEndPoint)) | ||
| if (_remoteEndPoint == null) | ||
| { | ||
| // detach user provided SA as it was updated in place. | ||
| _socketAddress = null; | ||
Member There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The only two operations it would be set for are ReceiveFrom and SendTo, and we already handled the SendTo case on the synchronous start path? MemberAuthor There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. yes. For SendTo we clear it when operation starts, for ReceiveFrom we do it when the operation is finished. | ||
| } | ||
| else if (!SocketAddressExtensions.Equals(_socketAddress!, _remoteEndPoint)) | ||
| { | ||
| try | ||
| { | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's ok to null it here because it's only used synchronously as part of the send operation and not asynchronously?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes. We will make
_socketAddressbefore first try. f we do not finish synchronously on Unix, it would be copied to queued*SendOperation. For Windows, theconst sockaddr *lpTois IN forWSASendToand AFAIK it does not need to be preserved until the overlapped IO is completed.