Skip to content

Commit 3651eb1

Browse files
author
Veijo Pesonen
committed
Puts back OOB processing to TCP receive
1 parent 0e890b7 commit 3651eb1

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

ESP8266/ESP8266.cpp

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -575,6 +575,11 @@ int32_t ESP8266::_recv_tcp_passive(int id, void *data, uint32_t amount, uint32_t
575575
int32_t len;
576576
int32_t ret = (int32_t)NSAPI_ERROR_WOULD_BLOCK;
577577

578+
// No flow control, drain the USART receive register ASAP to avoid data overrun
579+
if (_serial_rts == NC) {
580+
_process_oob(timeout, true);
581+
}
582+
578583
_smutex.lock();
579584

580585
// NOTE: documentation v3.0 says '+CIPRECVDATA:<data_len>,' but it's not how the FW responds...
@@ -598,6 +603,10 @@ int32_t ESP8266::_recv_tcp_passive(int id, void *data, uint32_t amount, uint32_t
598603
ret = done ? len : 0;
599604
}
600605

606+
// Flow control, read from USART receive register only when no more data is buffered, and as little as possible
607+
if (_serial_rts != NC) {
608+
_process_oob(timeout, false);
609+
}
601610
_smutex.unlock();
602611
return ret;
603612
}

0 commit comments

Comments
 (0)