zephyr/modusocket: First step to switch to alternative FIFO processing.
Here we wait for non-empty FIFO, and then directly access/drop its head element.
This commit is contained in:
parent
88c51c3592
commit
a3008e447c
@ -399,12 +399,14 @@ STATIC mp_uint_t sock_read(mp_obj_t self_in, void *buf, mp_uint_t max_len, int *
|
|||||||
}
|
}
|
||||||
|
|
||||||
DEBUG_printf("TCP recv: no cur_pkt, getting\n");
|
DEBUG_printf("TCP recv: no cur_pkt, getting\n");
|
||||||
struct net_pkt *pkt = k_fifo_get(&socket->recv_q, K_FOREVER);
|
_k_fifo_wait_non_empty(&socket->recv_q, K_FOREVER);
|
||||||
|
struct net_pkt *pkt = _k_fifo_peek_head(&socket->recv_q);
|
||||||
if (pkt == NULL) {
|
if (pkt == NULL) {
|
||||||
DEBUG_printf("TCP recv: NULL return from fifo\n");
|
DEBUG_printf("TCP recv: NULL return from fifo\n");
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
// Drop head packet from queue
|
||||||
|
k_fifo_get(&socket->recv_q, K_NO_WAIT);
|
||||||
|
|
||||||
DEBUG_printf("TCP recv: new cur_pkt: %p\n", pkt);
|
DEBUG_printf("TCP recv: new cur_pkt: %p\n", pkt);
|
||||||
socket->cur_pkt = pkt;
|
socket->cur_pkt = pkt;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user