Skip to content

Commit

Permalink
nanocoap_sock: use normal udp sock in nanocoap_server()
Browse files Browse the repository at this point in the history
  • Loading branch information
benpicco committed May 21, 2024
1 parent 7e69c13 commit dd458cb
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions sys/net/application_layer/nanocoap/sock.c
Original file line number Diff line number Diff line change
Expand Up @@ -789,7 +789,7 @@ ssize_t nanocoap_get_blockwise_url_to_buf(const char *url,

int nanocoap_server(sock_udp_ep_t *local, uint8_t *buf, size_t bufsize)
{
nanocoap_sock_t sock;
sock_udp_t sock;
sock_udp_ep_t remote;
coap_request_ctx_t ctx = {
.remote = &remote,
Expand All @@ -799,7 +799,7 @@ int nanocoap_server(sock_udp_ep_t *local, uint8_t *buf, size_t bufsize)
local->port = COAP_PORT;
}

ssize_t res = sock_udp_create(&sock.udp, local, NULL, 0);
ssize_t res = sock_udp_create(&sock, local, NULL, 0);
if (res != 0) {
return -1;
}
Expand All @@ -814,7 +814,7 @@ int nanocoap_server(sock_udp_ep_t *local, uint8_t *buf, size_t bufsize)
aux_in_ptr = &aux_in;
#endif

res = sock_udp_recv_aux(&sock.udp, buf, bufsize, SOCK_NO_TIMEOUT,
res = sock_udp_recv_aux(&sock, buf, bufsize, SOCK_NO_TIMEOUT,
&remote, aux_in_ptr);
if (res <= 0) {
DEBUG("nanocoap: error receiving UDP packet %" PRIdSIZE "\n", res);
Expand Down Expand Up @@ -844,7 +844,7 @@ int nanocoap_server(sock_udp_ep_t *local, uint8_t *buf, size_t bufsize)
continue;
}

sock_udp_send_aux(&sock.udp, buf, res, &remote, aux_out_ptr);
sock_udp_send_aux(&sock, buf, res, &remote, aux_out_ptr);
}

return 0;
Expand Down

0 comments on commit dd458cb

Please sign in to comment.