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

1846 server mqttserverstopasync doesnt indicate correct reason #1872

Merged

Conversation

chkr1011
Copy link
Collaborator

@chkr1011 chkr1011 commented Nov 4, 2023

This PR adds new overloads for the server so that the user can send custom user properties or reason codes when stopping the server.
It also fixes the issue that the default used reason code was not correct when stopping the server.
A new property is also added to the server which allows to stop accepting new connections while the server is still running.

@chkr1011 chkr1011 linked an issue Nov 4, 2023 that may be closed by this pull request
@chkr1011 chkr1011 merged commit ae84aa4 into master Nov 25, 2023
3 checks passed
@chkr1011 chkr1011 deleted the 1846-server-mqttserverstopasync-doesnt-indicate-correct-reason branch November 25, 2023 15:17
services.TryAddSingleton(new MqttFactory());

services.AddSingleton<MqttHostedServer>();
services.AddHostedService<MqttHostedServer>();
Copy link
Contributor

@JanEggers JanEggers Dec 3, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@chkr1011 this is bugged you will have 2 instances of MqttHostedServer. one when resolving the singleton and one IHostedService instance. use AddHostedService(c => c.GetRequiredService<MqttHostedServer>())

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @JanEggers for having a look at the change. Please see PR #1892 and let me know if it is correct now. I basically reverted the lines so that it is exactly the same as it was before.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Server: MqttServer.StopAsync() doesn't indicate correct reason
2 participants