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

simplify http / https handling #258

Merged
merged 2 commits into from
Jan 19, 2022
Merged

Conversation

seife
Copy link
Contributor

@seife seife commented Jan 18, 2022

instead of duplicating code for both WiFiClient and WiFiClientSecure,
use one pointer that gets assigned the corresponding class.

instead of duplicating code for both WiFiClient and WiFiClientSecure,
use one pointer that gets assigned the corresponding class.
this got (accidentally?) lost in the previous unrelated commit
31e32cc
@schreibfaul1 schreibfaul1 merged commit a6220af into schreibfaul1:master Jan 19, 2022
@schreibfaul1
Copy link
Owner

Thanks for the PR, maybe even destroy the _client object when not in use to save memory

@seife
Copy link
Contributor Author

seife commented Jan 19, 2022

Thanks for the PR, maybe even destroy the _client object when not in use to save memory

No! At least not in the current implementation. Now it is just a pointer to the statically allocated client and clientsecure instances.

We could dynamically create it with new() and destroy it with delete(), but this needs exact tracking of the objects lifetime. See the check I added in streamavail() and the default (dummy) assignment of _client in setDefaults(): this is exactly to avoid crashes due to _client not yet being initialized, but already used by the application.

It's also worth questioning how much this saves actually, as many devices will have an instance of the LWIP stack active anyway. I personally would wote for less complexity :-)

@seife seife deleted the simplify_ssl branch January 19, 2022 16:09
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.

None yet

2 participants