Skip to content

Commit

Permalink
Changed / added virtual functions for returning connection information (
Browse files Browse the repository at this point in the history
#8693)

Fixes the incorrect behavior of WiFiClientSecure.remoteIP(), .remotePort(), .localIP(), .localPort().
  • Loading branch information
JiriBilek committed Oct 31, 2022
1 parent d3eddeb commit 5f94a60
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
8 changes: 4 additions & 4 deletions libraries/ESP8266WiFi/src/WiFiClient.h
Original file line number Diff line number Diff line change
Expand Up @@ -91,10 +91,10 @@ class WiFiClient : public Client, public SList<WiFiClient> {
virtual uint8_t connected() override;
virtual operator bool() override;

IPAddress remoteIP();
uint16_t remotePort();
IPAddress localIP();
uint16_t localPort();
virtual IPAddress remoteIP();
virtual uint16_t remotePort();
virtual IPAddress localIP();
virtual uint16_t localPort();

static void setLocalPortStart(uint16_t port) { _localPort = port; }

Expand Down
5 changes: 5 additions & 0 deletions libraries/ESP8266WiFi/src/WiFiClientSecureBearSSL.h
Original file line number Diff line number Diff line change
Expand Up @@ -278,6 +278,11 @@ class WiFiClientSecure : public WiFiClient {
void flush() override { (void)flush(0); }
void stop() override { (void)stop(0); }

IPAddress remoteIP() override { return _ctx->remoteIP(); }
uint16_t remotePort() override { return _ctx->remotePort(); }
IPAddress localIP() override { return _ctx->localIP(); }
uint16_t localPort() override { return _ctx->localPort(); }

// Allow sessions to be saved/restored automatically to a memory area
void setSession(Session *session) { _ctx->setSession(session); }

Expand Down

0 comments on commit 5f94a60

Please sign in to comment.