Skip to content

Commit 88def54

Browse files
committed
Fixed wrong behaviour of EthernetClient::flush().
Fixes #1576
1 parent db640e0 commit 88def54

File tree

5 files changed

+15
-2
lines changed

5 files changed

+15
-2
lines changed

build/shared/revisions.txt

+1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ ARDUINO 1.5.5 BETA
44
[libraries]
55
* avr: Fixed buffer overflow in File::doBuffer() (dreggy)
66
* avr: Fixed timeout in Bridge::transfer()
7+
* avr: Fixed behavior of EthernetClient::flush()
78

89
ARDUINO 1.5.4 BETA 2013.09.10
910

libraries/Ethernet/arch/avr/utility/socket.cpp

+6
Original file line numberDiff line numberDiff line change
@@ -310,6 +310,12 @@ uint16_t recvfrom(SOCKET s, uint8_t *buf, uint16_t len, uint8_t *addr, uint16_t
310310
return data_len;
311311
}
312312

313+
/**
314+
* @brief Wait for buffered transmission to complete.
315+
*/
316+
void flush(SOCKET s) {
317+
// TODO
318+
}
313319

314320
uint16_t igmpsend(SOCKET s, const uint8_t * buf, uint16_t len)
315321
{

libraries/Ethernet/arch/sam/utility/socket.cpp

+6
Original file line numberDiff line numberDiff line change
@@ -310,6 +310,12 @@ uint16_t recvfrom(SOCKET s, uint8_t *buf, uint16_t len, uint8_t *addr, uint16_t
310310
return data_len;
311311
}
312312

313+
/**
314+
* @brief Wait for buffered transmission to complete.
315+
*/
316+
void flush(SOCKET s) {
317+
// TODO
318+
}
313319

314320
uint16_t igmpsend(SOCKET s, const uint8_t * buf, uint16_t len)
315321
{

libraries/Ethernet/src/EthernetClient.cpp

+1-2
Original file line numberDiff line numberDiff line change
@@ -120,8 +120,7 @@ int EthernetClient::peek() {
120120
}
121121

122122
void EthernetClient::flush() {
123-
while (available())
124-
read();
123+
::flush(_sock);
125124
}
126125

127126
void EthernetClient::stop() {

libraries/Ethernet/src/utility/socket.h

+1
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ extern int16_t recv(SOCKET s, uint8_t * buf, int16_t len); // Receive data (TCP)
1313
extern uint16_t peek(SOCKET s, uint8_t *buf);
1414
extern uint16_t sendto(SOCKET s, const uint8_t * buf, uint16_t len, uint8_t * addr, uint16_t port); // Send data (UDP/IP RAW)
1515
extern uint16_t recvfrom(SOCKET s, uint8_t * buf, uint16_t len, uint8_t * addr, uint16_t *port); // Receive data (UDP/IP RAW)
16+
extern void flush(SOCKET s); // Wait for transmission to complete
1617

1718
extern uint16_t igmpsend(SOCKET s, const uint8_t * buf, uint16_t len);
1819

0 commit comments

Comments
 (0)