mirror of
https://github.com/esp8266/Arduino.git
synced 2025-07-24 19:42:27 +03:00
* fix #1002 ::Flush() wait for empty send buffer * WiFiClient::Flush() guarantees that the data has been delivered option 1 of https://github.com/esp8266/Arduino/pull/3967#discussion_r156901071 10ms max wait according to loaded tcp echo/reply scheme
This commit is contained in:
@ -118,7 +118,7 @@ size_t EthernetUDP::write(const uint8_t *buffer, size_t size)
|
||||
int EthernetUDP::parsePacket()
|
||||
{
|
||||
// discard any remaining bytes in the last packet
|
||||
flush();
|
||||
clear_remaining();
|
||||
|
||||
if (recvAvailable(_sock) > 0)
|
||||
{
|
||||
@ -204,7 +204,7 @@ int EthernetUDP::peek()
|
||||
return b;
|
||||
}
|
||||
|
||||
void EthernetUDP::flush()
|
||||
void EthernetUDP::clear_remaining()
|
||||
{
|
||||
// could this fail (loop endlessly) if _remaining > 0 and recv in read fails?
|
||||
// should only occur if recv fails after telling us the data is there, lets
|
||||
@ -216,3 +216,8 @@ void EthernetUDP::flush()
|
||||
}
|
||||
}
|
||||
|
||||
void EthernetUDP::flush()
|
||||
{
|
||||
endPacket();
|
||||
}
|
||||
|
||||
|
@ -49,6 +49,9 @@ private:
|
||||
uint16_t _remotePort; // remote port for the incoming packet whilst it's being processed
|
||||
uint16_t _offset; // offset into the packet being sent
|
||||
uint16_t _remaining; // remaining bytes of incoming packet yet to be processed
|
||||
|
||||
protected:
|
||||
void clear_remaining();
|
||||
|
||||
public:
|
||||
EthernetUDP(); // Constructor
|
||||
|
Reference in New Issue
Block a user