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

Bugfix/esp8266 http client #5232

Closed
wants to merge 5 commits into from
Closed

Bugfix/esp8266 http client #5232

wants to merge 5 commits into from

Conversation

Jeroen88
Copy link
Contributor

Removed unnecessary code

@Jeroen88
Copy link
Contributor Author

Jeroen88 commented Oct 12, 2018

@earlephilhower The current version of the library does not handle Connections that may be reused correctly. If the programmer calls end() directly, the connection may be reused, so it should NOT be _client->stop() nor should _client = nullptr and also not _tcpDprecated.reset(nullptr)!!!

If end() is called from begin() the connection should also not be closed, for the same reason. The only exception to this is when a changeover is made from the old api to the new or vice versa.

However, just before destruction ~ESP8266HTTPClient() the connection should be _client->stop(), because now the connection will be definitely closed. In the previous versions the destructor took care of this, but not anymore because of the bugfix.
I think it would be the best solution if it would still be possible to have the destructor stop the connection, but I do not know how. The only option I can think of is a new function that should be called before the ESP8266HTTPClient is destructed, but this changes the API and is error prone. Any ideas?

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.

1 participant