Skip to content

Conversation

earlephilhower
Copy link
Collaborator

Fixes #8079

Because WiFiClientSecure inherits WiFiClient, and WiFiClientSecureCtx also
inherits WiFiClient, they both end up in the list of TCP connections that
are used for WiFiClient::stopAllExcept(). This would cause the underlying
SSL connection to be closed whenever you attempted to
stopAllExcept(WiFiClientSecure)

Fix by adding a "_owner" pointer in the WiFiClient object which points to
nullptr (default case) or to the associated upper-layer connection.
When stopping all connections except one, only look at the uppermost
connections.

Fixes esp8266#8079 Because WiFiClientSecure inherits WiFiClient, and WiFiClientSecureCtx also inherits WiFiClient, they both end up in the list of TCP connections that are used for WiFiClient::stopAllExcept(). This would cause the underlying SSL connection to be closed whenever you attempted to stopAllExcept(WiFiClientSecure) Fix by adding a "_owner" pointer in the WiFiClient object which points to nullptr (default case) or to the associated upper-layer connection. When stopping all connections except one, only look at the uppermost connections.
@earlephilhower
Copy link
Collaborator Author

@d-a-v, I think I need to reverse the sense here and look at the lowest-level, not uppermost one. So hold off on any review or merge, please.

Because there may be multiple copies of the WiFiClientSecure, but only a single WiFiClientCtx, use the Ctx to check for relatedness on connections. This will avoid closing SSL connections that were assignment copies.
@earlephilhower
Copy link
Collaborator Author

Okay, good to go @d-a-v. Logic reversed and tested locally.

@d-a-v d-a-v added the alpha included in alpha release label Jun 17, 2021
@earlephilhower earlephilhower merged commit 45e7976 into esp8266:master Jun 20, 2021
@earlephilhower earlephilhower deleted the ctx1 branch June 20, 2021 17:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

alpha included in alpha release

2 participants