1
0
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:
Ivan Grokhotkov 2016-03-24 01:14:48 +03:00
parent 2bc6d6b4a2
commit 213914e1ce
2 changed files with 4 additions and 10 deletions

View File

@ -81,19 +81,11 @@ void WiFiServer::begin() {
}
void WiFiServer::setNoDelay(bool nodelay) {
if (!_pcb)
return;
if (nodelay)
tcp_nagle_disable(_pcb);
else
tcp_nagle_enable(_pcb);
_noDelay = nodelay;
}
bool WiFiServer::getNoDelay() {
if (!_pcb)
return false;
return tcp_nagle_disabled(_pcb);
return _noDelay;
}
bool WiFiServer::hasClient() {
@ -106,6 +98,7 @@ WiFiClient WiFiServer::available(byte* status) {
if (_unclaimed) {
WiFiClient result(_unclaimed);
_unclaimed = _unclaimed->next();
result.setNoDelay(_noDelay);
DEBUGV("WS:av\r\n");
return result;
}

View File

@ -42,6 +42,7 @@ private:
ClientContext* _unclaimed;
ClientContext* _discarded;
bool _noDelay = false;
public:
WiFiServer(IPAddress addr, uint16_t port);