Commit 868453d3 authored by Paul Sokolovsky's avatar Paul Sokolovsky
Browse files

zephyr/modusocket: sock_read: Check socket status only at the start of packet.

Otherwise, if we already have a packet in progress, finish it first, before
check "peer closed" status.
parent 1fe0f678
......@@ -373,11 +373,12 @@ STATIC mp_uint_t sock_read(mp_obj_t self_in, void *buf, mp_uint_t max_len, int *
} else if (sock_type == SOCK_STREAM) {
do {
if (socket->state == STATE_PEER_CLOSED) {
return 0;
}
if (socket->cur_buf == NULL) {
if (socket->state == STATE_PEER_CLOSED) {
return 0;
}
DEBUG_printf("TCP recv: no cur_buf, getting\n");
struct net_buf *net_buf = k_fifo_get(&socket->recv_q, K_FOREVER);
// Restore ->frags overwritten by fifo
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment