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

Add support WiFiClientSecure TCP KeepAlive #8940

Merged
merged 4 commits into from
Jun 11, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions libraries/ESP8266WiFi/src/WiFiClient.h
Original file line number Diff line number Diff line change
Expand Up @@ -107,12 +107,12 @@ class WiFiClient : public Client, public SList<WiFiClient> {
static void stopAll();
static void stopAllExcept(WiFiClient * c);

void keepAlive (uint16_t idle_sec = TCP_DEFAULT_KEEPALIVE_IDLE_SEC, uint16_t intv_sec = TCP_DEFAULT_KEEPALIVE_INTERVAL_SEC, uint8_t count = TCP_DEFAULT_KEEPALIVE_COUNT);
bool isKeepAliveEnabled () const;
uint16_t getKeepAliveIdle () const;
uint16_t getKeepAliveInterval () const;
uint8_t getKeepAliveCount () const;
void disableKeepAlive () { keepAlive(0, 0, 0); }
virtual void keepAlive (uint16_t idle_sec = TCP_DEFAULT_KEEPALIVE_IDLE_SEC, uint16_t intv_sec = TCP_DEFAULT_KEEPALIVE_INTERVAL_SEC, uint8_t count = TCP_DEFAULT_KEEPALIVE_COUNT);
virtual bool isKeepAliveEnabled () const;
virtual uint16_t getKeepAliveIdle () const;
virtual uint16_t getKeepAliveInterval () const;
virtual uint8_t getKeepAliveCount () const;
virtual void disableKeepAlive () { keepAlive(0, 0, 0); }

// default NoDelay=False (Nagle=True=!NoDelay)
// Nagle is for shortly delaying outgoing data, to send less/bigger packets
Expand Down
15 changes: 15 additions & 0 deletions libraries/ESP8266WiFi/src/WiFiClientSecureBearSSL.h
Original file line number Diff line number Diff line change
Expand Up @@ -357,6 +357,21 @@ class WiFiClientSecure : public WiFiClient {

// consume bytes after use (see peekBuffer)
virtual void peekConsume (size_t consume) override { return _ctx->peekConsume(consume); }

void keepAlive(uint16_t idle_sec = TCP_DEFAULT_KEEPALIVE_IDLE_SEC, uint16_t intv_sec = TCP_DEFAULT_KEEPALIVE_INTERVAL_SEC, uint8_t count = TCP_DEFAULT_KEEPALIVE_COUNT) override
{
_ctx->keepAlive(idle_sec, intv_sec, count);
}

bool isKeepAliveEnabled() const override { return _ctx->isKeepAliveEnabled(); };

uint16_t getKeepAliveIdle() const override { return _ctx->getKeepAliveIdle(); };

uint16_t getKeepAliveInterval() const override { return _ctx->getKeepAliveInterval(); };

uint8_t getKeepAliveCount() const override { return _ctx->getKeepAliveCount(); };

void disableKeepAlive() override { _ctx->disableKeepAlive(); };

private:
std::shared_ptr<WiFiClientSecureCtx> _ctx;
Expand Down