Skip to content

WiFiClientSecure::setTimeout() inconsistency with WiFiClient::setTimeout() #6429

Closed
@gonzabrusco

Description

@gonzabrusco

Board

ESP32 Dev Module

Device Description

ESP32 Dev Module

Hardware Configuration

ESP32 Dev Module

Version

latest master

IDE Name

PlatformIO

Operating System

Windows 10

Flash frequency

40Mhz

PSRAM enabled

no

Upload speed

115200

Description

This is not a bug per se, but an inconsistency I have noticed.

WiFiClientSecure::setTimeout() does nothing.

int setTimeout(uint32_t seconds){ return 0; }

but WiFiClient::setTimeout() actually sets the timeout.

int WiFiClient::setTimeout(uint32_t seconds)

Also, this inconsistency extends to other parts of the core. For example this:

client.setTimeout(12000 / 1000); // timeout argument is defined in seconds for setTimeout

Here it is using setTimeout on a WiFiClientSecure because "Reading data over SSL may be slow, use an adequate timeout". But in reality it does just nothing...

The HTTPClient code also uses the setTimeout function, but it ignores if the WiFiClient passed is a WiFiClient object or a WiFiClientSecure object (thus, setting the timeout incorrectly on the second case).

_client->setTimeout((_tcpTimeout + 500) / 1000);

_client->setTimeout((timeout + 500) / 1000);

Shouldn't both method do the "same"? (not the same as "the same code" but as the "same spirit"). I guess the setTimeout method in WiFiClientSecure should call some mbedtls funcion to set the timeout? This is just a guess, that part of the core kind of exceeds my knowledge.

Sketch

No sketch

Debug Message

No message.

Other Steps to Reproduce

No response

I have checked existing issues, online documentation and the Troubleshooting Guide

  • I confirm I have checked existing issues, online documentation and Troubleshooting guide.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    Status

    Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions