diff --git a/hardware/arduino/avr/libraries/SoftwareSerial/SoftwareSerial.cpp b/hardware/arduino/avr/libraries/SoftwareSerial/SoftwareSerial.cpp index 80df664fab0..0a16ff7108b 100644 --- a/hardware/arduino/avr/libraries/SoftwareSerial/SoftwareSerial.cpp +++ b/hardware/arduino/avr/libraries/SoftwareSerial/SoftwareSerial.cpp @@ -469,13 +469,7 @@ size_t SoftwareSerial::write(uint8_t b) void SoftwareSerial::flush() { - if (!isListening()) - return; - - uint8_t oldSREG = SREG; - cli(); - _receive_buffer_head = _receive_buffer_tail = 0; - SREG = oldSREG; + // There is no tx buffering, simply return } int SoftwareSerial::peek() diff --git a/libraries/Ethernet/src/EthernetUdp.cpp b/libraries/Ethernet/src/EthernetUdp.cpp index 2baee82dfb4..8066783aefa 100644 --- a/libraries/Ethernet/src/EthernetUdp.cpp +++ b/libraries/Ethernet/src/EthernetUdp.cpp @@ -118,7 +118,12 @@ size_t EthernetUDP::write(const uint8_t *buffer, size_t size) int EthernetUDP::parsePacket() { // discard any remaining bytes in the last packet - flush(); + while (_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 + // hope the w5100 always behaves :) + read(); + } if (recvAvailable(_sock) > 0) { @@ -206,14 +211,7 @@ int EthernetUDP::peek() void EthernetUDP::flush() { - // 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 - // hope the w5100 always behaves :) - - while (_remaining) - { - read(); - } + // TODO: we should wait for TX buffer to be emptied } /* Start EthernetUDP socket, listening at local port PORT */ diff --git a/libraries/WiFi/src/WiFiClient.cpp b/libraries/WiFi/src/WiFiClient.cpp index 8fb4134993a..eb8e6af1dec 100644 --- a/libraries/WiFi/src/WiFiClient.cpp +++ b/libraries/WiFi/src/WiFiClient.cpp @@ -140,8 +140,7 @@ int WiFiClient::peek() { } void WiFiClient::flush() { - while (available()) - read(); + // TODO: a real check to ensure transmission has been completed } void WiFiClient::stop() { diff --git a/libraries/WiFi/src/WiFiUdp.cpp b/libraries/WiFi/src/WiFiUdp.cpp index 45298c5bc81..95402433950 100644 --- a/libraries/WiFi/src/WiFiUdp.cpp +++ b/libraries/WiFi/src/WiFiUdp.cpp @@ -155,8 +155,7 @@ int WiFiUDP::peek() void WiFiUDP::flush() { - while (available()) - read(); + // TODO: a real check to ensure transmission has been completed } IPAddress WiFiUDP::remoteIP()