1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2024-12-29 04:50:03 +01:00

Merge pull request #15484 from miri64/mbox/enh/use-new-api

pkg/lwip / pkg/tinydtls: use new mbox_avail() / mbox_unset() function.
This commit is contained in:
Martine Lenders 2020-11-20 20:17:48 +01:00 committed by GitHub
commit d10782271e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 10 additions and 10 deletions

View File

@ -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

View File

@ -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;
}

View File

@ -461,7 +461,7 @@ static ssize_t _copy_buffer(sock_dtls_t *sock, sock_dtls_session_t *remote,
&remote->ep);
if (sock->async_cb &&
/* is there a message in the sock's mbox? */
cib_avail(&sock->mbox.cib)) {
mbox_avail(&sock->mbox)) {
if (sock->buffer.data) {
sock->async_cb(sock, SOCK_ASYNC_MSG_RECV,
sock->async_cb_arg);
@ -493,7 +493,7 @@ static ssize_t _complete_handshake(sock_dtls_t *sock,
if (sock->async_cb) {
sock_async_flags_t flags = SOCK_ASYNC_CONN_RDY;
if (cib_avail(&sock->mbox.cib)) {
if (mbox_avail(&sock->mbox)) {
if (sock->buffer.data) {
flags |= SOCK_ASYNC_MSG_RECV;
}