Skip to content

Commit

Permalink
fix(client): Make flush() call clear() and deprecate it
Browse files Browse the repository at this point in the history
This is a compromise for issues caused by #9453
  • Loading branch information
me-no-dev committed Aug 26, 2024
1 parent cd3d0bf commit 9cb5dd5
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 2 deletions.
4 changes: 3 additions & 1 deletion libraries/Network/src/NetworkClient.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -369,7 +369,9 @@ int NetworkClient::read() {
return data;
}

void NetworkClient::flush() {}
void NetworkClient::flush() {
clear();
}

size_t NetworkClient::write(const uint8_t *buf, size_t size) {
int res = 0;
Expand Down
1 change: 1 addition & 0 deletions libraries/Network/src/NetworkClient.h
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ class NetworkClient : public ESPLwIPClient {
size_t write(const uint8_t *buf, size_t size);
size_t write_P(PGM_P buf, size_t size);
size_t write(Stream &stream);
[[deprecated("Use clear() instead.")]]
void flush(); // Print::flush tx
int available();
int read();
Expand Down
4 changes: 3 additions & 1 deletion libraries/Network/src/NetworkUdp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -288,7 +288,9 @@ size_t NetworkUDP::write(const uint8_t *buffer, size_t size) {
return i;
}

void NetworkUDP::flush() {}
void NetworkUDP::flush() {
clear();
}

int NetworkUDP::parsePacket() {
if (rx_buffer) {
Expand Down
1 change: 1 addition & 0 deletions libraries/Network/src/NetworkUdp.h
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ class NetworkUDP : public UDP {
int endPacket();
size_t write(uint8_t);
size_t write(const uint8_t *buffer, size_t size);
[[deprecated("Use clear() instead.")]]
void flush(); // Print::flush tx
int parsePacket();
int available();
Expand Down

0 comments on commit 9cb5dd5

Please sign in to comment.