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

Autopaho: Call error call back a maximum of once per connection #158

Merged
merged 2 commits into from
Aug 9, 2023
Merged

Autopaho: Call error call back a maximum of once per connection #158

merged 2 commits into from
Aug 9, 2023

Conversation

MattBrittan
Copy link
Contributor

autoPaho had the potential to call the error call beck multiple times in relation to one event.
This mirrored the paho functionality but does not make much sense from an end user perspective,
so this change prevents multiple calls to OnClientError in relation to a single connection.
We also prevent errors from being logger when the user has called Disconnect (it's not an error
if it's the result of a request) and add a test.

closes #157

… in relation to one event.

This mirrored the paho functionality but does not make much sense from an end user perspective,
so this change prevents multiple calls to `OnClientError` in relation to a single connection.
We also prevent errors from being logger when the user has called `Disconnect` (it's not an error
if it's the result of a request).
@MattBrittan MattBrittan changed the title Call error call back a maximum of once per connection Autopaho: Call error call back a maximum of once per connection Aug 8, 2023
@MattBrittan MattBrittan added the Autopaho Autopaho specific label Aug 8, 2023
@MattBrittan MattBrittan mentioned this pull request Aug 8, 2023
Copy link
Contributor

@thejan2009 thejan2009 left a comment

Choose a reason for hiding this comment

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

This seems reasonable, given that paho will close the connection on error. I've tested the commit in two different applications and observed no more bogus "use of closed network connection" errors.

} else {
e.debug.Printf("received extra error: %s", err)
return false
Copy link
Contributor

Choose a reason for hiding this comment

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

Nitpick, we can now avoid else clause because of return statements.

@MattBrittan MattBrittan merged commit 21b4033 into eclipse:master Aug 9, 2023
@MattBrittan MattBrittan deleted the singleerror branch November 4, 2023 01:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Autopaho Autopaho specific
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Useless "use of closed network connection" error after autopaho disconnect
2 participants