mirror of
https://github.com/RIOT-OS/RIOT.git
synced 2025-12-25 06:23:53 +01:00
lwip_sock: use new mbox_avail() function
This commit is contained in:
parent
dd1de91c63
commit
71224b4b1e
@ -283,10 +283,10 @@ static void _netconn_cb(struct netconn *conn, enum netconn_evt evt,
|
||||
default:
|
||||
break;
|
||||
}
|
||||
if (cib_avail(&conn->acceptmbox.mbox.cib)) {
|
||||
if (mbox_avail(&conn->acceptmbox.mbox)) {
|
||||
flags |= SOCK_ASYNC_CONN_RECV;
|
||||
}
|
||||
if (cib_avail(&conn->recvmbox.mbox.cib)) {
|
||||
if (mbox_avail(&conn->recvmbox.mbox)) {
|
||||
flags |= SOCK_ASYNC_MSG_RECV;
|
||||
}
|
||||
#endif
|
||||
@ -524,7 +524,7 @@ int lwip_sock_recv(struct netconn *conn, uint32_t timeout, struct netbuf **buf)
|
||||
}
|
||||
else
|
||||
#endif
|
||||
if ((timeout == 0) && !cib_avail(&conn->recvmbox.mbox.cib)) {
|
||||
if ((timeout == 0) && !mbox_avail(&conn->recvmbox.mbox)) {
|
||||
return -EAGAIN;
|
||||
}
|
||||
switch (netconn_recv(conn, buf)) {
|
||||
@ -550,7 +550,7 @@ int lwip_sock_recv(struct netconn *conn, uint32_t timeout, struct netbuf **buf)
|
||||
#if IS_ACTIVE(SOCK_HAS_ASYNC)
|
||||
lwip_sock_base_t *sock = netconn_get_callback_arg(conn);
|
||||
|
||||
if (sock && sock->async_cb.gen && cib_avail(&conn->recvmbox.mbox.cib)) {
|
||||
if (sock && sock->async_cb.gen && mbox_avail(&conn->recvmbox.mbox)) {
|
||||
sock->async_cb.gen(sock, SOCK_ASYNC_MSG_RECV, sock->async_cb_arg);
|
||||
}
|
||||
#endif
|
||||
|
||||
@ -210,7 +210,7 @@ int sock_tcp_accept(sock_tcp_queue_t *queue, sock_tcp_t **sock,
|
||||
}
|
||||
else
|
||||
#endif
|
||||
if ((timeout == 0) && !cib_avail(&queue->base.conn->acceptmbox.mbox.cib)) {
|
||||
if ((timeout == 0) && !mbox_avail(&queue->base.conn->acceptmbox.mbox)) {
|
||||
mutex_unlock(&queue->mutex);
|
||||
return -EAGAIN;
|
||||
}
|
||||
@ -245,7 +245,7 @@ int sock_tcp_accept(sock_tcp_queue_t *queue, sock_tcp_t **sock,
|
||||
}
|
||||
}
|
||||
else {
|
||||
while (cib_avail(&queue->base.conn->acceptmbox.mbox.cib)) {
|
||||
while (mbox_avail(&queue->base.conn->acceptmbox.mbox)) {
|
||||
/* close connections potentially accepted by lwIP */
|
||||
if (netconn_accept(queue->base.conn, &tmp) == ERR_OK) {
|
||||
netconn_close(tmp);
|
||||
@ -259,7 +259,7 @@ int sock_tcp_accept(sock_tcp_queue_t *queue, sock_tcp_t **sock,
|
||||
#endif
|
||||
#if IS_ACTIVE(SOCK_HAS_ASYNC)
|
||||
if (queue->base.async_cb.gen &&
|
||||
cib_avail(&queue->base.conn->acceptmbox.mbox.cib)) {
|
||||
mbox_avail(&queue->base.conn->acceptmbox.mbox)) {
|
||||
queue->base.async_cb.gen(&queue->base, SOCK_ASYNC_CONN_RECV,
|
||||
queue->base.async_cb_arg);
|
||||
}
|
||||
@ -294,7 +294,7 @@ ssize_t sock_tcp_read(sock_tcp_t *sock, void *data, size_t max_len,
|
||||
}
|
||||
else
|
||||
#endif
|
||||
if ((timeout == 0) && !cib_avail(&sock->base.conn->recvmbox.mbox.cib)) {
|
||||
if ((timeout == 0) && !mbox_avail(&sock->base.conn->recvmbox.mbox)) {
|
||||
mutex_unlock(&sock->mutex);
|
||||
return -EAGAIN;
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user