mirror of
https://github.com/esp8266/Arduino.git
synced 2025-04-19 23:22:16 +03:00
Return data in internal SSL buffers after close (#4756)
When the TCP socket is closed there may be some data left in the BearSSL internal buffers which can be read by the application. The BearSSL pump, however, would always return no data available in the case the socket was disconnected before checking if the SSL was in a state where the app could possibly read. Fix by returning if the state is available, even if the connection is gone. Eventually no more data will become available to read and the original -1 will be returned. This should match the existing axTLS ::connected() behavior.
This commit is contained in:
parent
9b5f3c2882
commit
529baabef8
@ -228,8 +228,7 @@ bool WiFiClientSecure::_clientConnected() {
|
||||
}
|
||||
|
||||
uint8_t WiFiClientSecure::connected() {
|
||||
if (WiFiClient::connected() || available() ||
|
||||
(_clientConnected() && _handshake_done)) {
|
||||
if (available() || (_clientConnected() && _handshake_done)) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
@ -398,7 +397,7 @@ int WiFiClientSecure::_run_until(unsigned target, bool blocking) {
|
||||
}
|
||||
|
||||
if (!(_client->state() == ESTABLISHED) && !WiFiClient::available()) {
|
||||
return -1;
|
||||
return (state & target) ? 0 : -1;
|
||||
}
|
||||
|
||||
/*
|
||||
|
Loading…
x
Reference in New Issue
Block a user