Skip to content

Commit 4fe83a5

Browse files
committed
EthernetClient - handle aborting and escape write() if conn closed
- if the other end stopped responding write() looped forever because close flags were cleared already
1 parent a219c61 commit 4fe83a5

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/EthernetClient.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,7 @@ UIPClient::_write(uip_userdata_t* u, const uint8_t *buf, size_t size)
172172
#endif
173173
repeat:
174174
UIPEthernetClass::tick();
175-
if (u && !(u->state & (UIP_CLIENT_CLOSE | UIP_CLIENT_REMOTECLOSED)))
175+
if (u && u->state && !(u->state & (UIP_CLIENT_CLOSE | UIP_CLIENT_REMOTECLOSED)))
176176
{
177177
uint8_t p = _currentBlock(u->packets_out);
178178
if (u->packets_out[p] == NOBLOCK)
@@ -420,7 +420,7 @@ uipclient_appcall(void)
420420
uip_restart();
421421
}
422422
// If the connection has been closed, save received but unread data.
423-
if (uip_closed() || uip_timedout())
423+
if (uip_closed() || uip_timedout() || uip_aborted())
424424
{
425425
#ifdef UIPETHERNET_DEBUG_CLIENT
426426
Serial.println(F("UIPClient uip_closed"));

0 commit comments

Comments
 (0)