mirror of
https://github.com/esp8266/Arduino.git
synced 2025-04-27 21:16:50 +03:00
Fix undefined behaviour in WiFiServer::setNoDelay (#1695)
This commit is contained in:
parent
2bc6d6b4a2
commit
213914e1ce
@ -81,19 +81,11 @@ void WiFiServer::begin() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void WiFiServer::setNoDelay(bool nodelay) {
|
void WiFiServer::setNoDelay(bool nodelay) {
|
||||||
if (!_pcb)
|
_noDelay = nodelay;
|
||||||
return;
|
|
||||||
|
|
||||||
if (nodelay)
|
|
||||||
tcp_nagle_disable(_pcb);
|
|
||||||
else
|
|
||||||
tcp_nagle_enable(_pcb);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool WiFiServer::getNoDelay() {
|
bool WiFiServer::getNoDelay() {
|
||||||
if (!_pcb)
|
return _noDelay;
|
||||||
return false;
|
|
||||||
return tcp_nagle_disabled(_pcb);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool WiFiServer::hasClient() {
|
bool WiFiServer::hasClient() {
|
||||||
@ -106,6 +98,7 @@ WiFiClient WiFiServer::available(byte* status) {
|
|||||||
if (_unclaimed) {
|
if (_unclaimed) {
|
||||||
WiFiClient result(_unclaimed);
|
WiFiClient result(_unclaimed);
|
||||||
_unclaimed = _unclaimed->next();
|
_unclaimed = _unclaimed->next();
|
||||||
|
result.setNoDelay(_noDelay);
|
||||||
DEBUGV("WS:av\r\n");
|
DEBUGV("WS:av\r\n");
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
@ -42,6 +42,7 @@ private:
|
|||||||
|
|
||||||
ClientContext* _unclaimed;
|
ClientContext* _unclaimed;
|
||||||
ClientContext* _discarded;
|
ClientContext* _discarded;
|
||||||
|
bool _noDelay = false;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
WiFiServer(IPAddress addr, uint16_t port);
|
WiFiServer(IPAddress addr, uint16_t port);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user