-
Notifications
You must be signed in to change notification settings - Fork 13.3k
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
Fix WiFiClientSecure remoteIP(), remotePort(), localIP(), localPort() functions #8693
Conversation
Fixes the incorrect behavior of WiFiClientSecure.remoteIP(), .remotePort(), .localIP(), .localPort().
Notice that keep alive also has this problem. Could we go about fixing the inheritance / class access instead of proxying these methods or adding even more virtual calls? |
I find the multiple inheritance of WiFiClient (in WiFiClientSecure and WiFiClientSecureCtx) confusing. Having read the comment
I thought the change was made on purpose and I didn't think of it more. IMO changing the inheritance would result in lot of work quite close to the rule 'if it ain't broken don't fix it'. Although, I know, it is a bit broken. |
Main issue is, bit by bit it becomes even more broken and not really fixed. Plus, anyone reading this now or in the future either thinks C++ is insane or this is the right way to do this kind of thing (whatever the thing is). So am leaning more to fixing the overall situation instead of patching it here and there. With the same idea as #7680, just doing it a bit different More comments were added after the fact, when the clone() was introduced to fix object copies, but that was more of a sidenote thing to understand what's happening there. And lack of time was another factor of not really fixing anything |
Hi, I agree with you that doing multiple fixes makes the code bad and hard to maintain. |
I see only two options how to solve remoteIP & co. if they should work for WiFiClientSecure executed over WiFiClient pointer.
|
(edit: I am just rude :/ misread the above)
only for the reasons described above - because the way it was written originally!
nothing of sorts, just making it possible to copy wificlient and manage clientcontext with something. i.e. handle refs, unrefs, and removing another weird quirk of self-deleting itself on refcnt zero. So far my understanding is no-one had time to do this, so I will PR my changes instead as soon as I figure out where to put keep alive consts and flush timeout. Meaning, we revert to the old WiFiClientSecure : WiFiClient inheritance without an extra class and just use the original methods to get remote & local address info. |
... and also ref. #7612 (comment) |
but in a perspective of the 3.1.0 release? maybe merge this PR for 3.1.0 and make the larger rewrite for 3.2.0? |
Likely, not closing anything yet.
|
Fixes the #8692
Fixes the incorrect behavior of WiFiClientSecure.remoteIP(), .remotePort(), .localIP(), .localPort().