Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pkg/lwip / pkg/tinydtls: use new mbox_avail() / mbox_unset() function. #15484

Merged
merged 2 commits into from
Nov 20, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions pkg/lwip/contrib/sock/lwip_sock.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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)) {
Expand All @@ -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
Expand Down
8 changes: 4 additions & 4 deletions pkg/lwip/contrib/sock/tcp/lwip_sock_tcp.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down Expand Up @@ -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);
Expand All @@ -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);
}
Expand Down Expand Up @@ -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;
}
Expand Down
4 changes: 2 additions & 2 deletions pkg/tinydtls/contrib/sock_dtls.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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;
}
Expand Down