Skip to content

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

Merged
merged 2 commits into from
Sep 11, 2020
Merged

Send CloseMessage in more cases #25693

merged 2 commits into from
Sep 11, 2020

Conversation

BrennanConroy
Copy link
Member

The CloseMessage(allowReconnect: false) was not being sent when Context.Abort() was called, which resulted in clients potentially attempting a reconnect. This fixes it so that the CloseMessage can be sent now so well behaved clients wont attempt an unwanted reconnect.

Fixes #21422

@BrennanConroy BrennanConroy added the area-signalr Includes: SignalR clients and servers label Sep 8, 2020
@BrennanConroy BrennanConroy added this to the 5.0.0-rc2 milestone Sep 8, 2020
@davidfowl
Copy link
Member

Back port?

@BrennanConroy
Copy link
Member Author

Back port?

We can consider it once this is merged

@halter73
Copy link
Member

halter73 commented Sep 9, 2020

/azp run aspnetcore-ci

@azure-pipelines
Copy link

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);
Copy link
Member

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.

Copy link
Member

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!? 😮

Copy link
Member

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 😆

@BrennanConroy
Copy link
Member Author

@Pilchie for RC2

@Pilchie Pilchie added the Servicing-approved Shiproom has approved the issue label Sep 10, 2020
@Pilchie
Copy link
Member

Pilchie commented Sep 10, 2020

Approved for .NET 5 RC2.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-signalr Includes: SignalR clients and servers Servicing-approved Shiproom has approved the issue
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants