-
Notifications
You must be signed in to change notification settings - Fork 10.3k
Send CloseMessage in more cases #25693
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
Conversation
Back port? |
We can consider it once this is merged |
/azp run aspnetcore-ci |
Azure Pipelines successfully started running 1 pipeline(s). |
@@ -226,7 +226,7 @@ private async Task SendCloseAsync(HubConnectionContext connection, Exception? ex | |||
|
|||
try | |||
{ | |||
await connection.WriteAsync(closeMessage); | |||
await connection.WriteCloseAsync(closeMessage); |
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.
I prefer adding an ignoreAbort = false
parameter to WriteAsync. Where it checks if (_connectionAborted)
today, we'd change that to if (_connectionAborted && !ignoreAbort)
. That way if we make a change to WriteAsync in the future, we get it for free without having to remember to also update WriteCloseAsync.
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.
and add a branch to every single write!? 😮
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.
But the branch is already there 😆
@Pilchie for RC2 |
Approved for .NET 5 RC2. |
The
CloseMessage(allowReconnect: false)
was not being sent whenContext.Abort()
was called, which resulted in clients potentially attempting a reconnect. This fixes it so that theCloseMessage
can be sent now so well behaved clients wont attempt an unwanted reconnect.Fixes #21422