Skip to content
Snippets Groups Projects
Commit d70a94f1 authored by Sören Tempel's avatar Sören Tempel
Browse files

nanocoap: fix sock_udp return value checks

parent f7e524d1
No related branches found
No related tags found
No related merge requests found
......@@ -128,17 +128,17 @@ int nanocoap_server(sock_udp_ep_t *local, uint8_t *buf, size_t bufsize)
}
ssize_t res = sock_udp_create(&sock, local, NULL, 0);
if (res == -1) {
if (res != 0) {
return -1;
}
while (1) {
res = sock_udp_recv(&sock, buf, bufsize, -1, &remote);
if (res == -1) {
if (res < 0) {
DEBUG("error receiving UDP packet\n");
return -1;
}
else {
else if (res > 0) {
coap_pkt_t pkt;
if (coap_parse(&pkt, (uint8_t *)buf, res) < 0) {
DEBUG("error parsing packet\n");
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment