Skip to content

Commit

Permalink
coap-chat/coap.c: apply api changes
Browse files Browse the repository at this point in the history
  • Loading branch information
fjmolinas authored and chrysn committed Sep 20, 2022
1 parent e0e2e40 commit b0307a4
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions coap-chat/coap.c
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,8 @@ static size_t _send(uint8_t *buf, size_t len, char *addr_str)
remote.family = AF_INET6;

/* parse for interface */
int iface = ipv6_addr_split_iface(addr_str);
if (iface == -1) {
char *iface = ipv6_addr_split_iface(addr_str);
if (!iface) {
if (gnrc_netif_numof() == 1) {
/* assign the single interface found in gnrc_netif_numof() */
remote.netif = (uint16_t)gnrc_netif_iter(NULL)->pid;
Expand All @@ -74,11 +74,11 @@ static size_t _send(uint8_t *buf, size_t len, char *addr_str)
}
}
else {
if (gnrc_netif_get_by_pid(iface) == NULL) {
if (gnrc_netif_get_by_pid(atoi(iface)) == NULL) {
DEBUG("[CoAP] interface not valid");
return 0;
}
remote.netif = iface;
remote.netif = atoi(iface);
}

/* parse destination address */
Expand All @@ -95,7 +95,7 @@ static size_t _send(uint8_t *buf, size_t len, char *addr_str)
/* parse port */
remote.port = GCOAP_PORT;

return gcoap_req_send2(buf, len, &remote, NULL);
return gcoap_req_send(buf, len, &remote, NULL, NULL);
}

int coap_post(char *addr, char *msgbuf, size_t msglen)
Expand Down

0 comments on commit b0307a4

Please sign in to comment.