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

tests: make use of nanocoap_request_simple()

This commit is contained in:
Benjamin Valentin 2022-01-28 18:03:28 +01:00
parent 0b768e5602
commit e56d744069
2 changed files with 2 additions and 14 deletions

View File

@ -33,8 +33,6 @@ static ssize_t _send(coap_pkt_t *pkt, size_t len, char *addr_str, char *port_str
{
ipv6_addr_t addr;
sock_udp_ep_t remote;
sock_udp_t sock;
ssize_t res;
remote.family = AF_INET6;
@ -76,11 +74,7 @@ static ssize_t _send(coap_pkt_t *pkt, size_t len, char *addr_str, char *port_str
return 0;
}
nanocoap_connect(&sock, NULL, &remote);
res = nanocoap_request(&sock, pkt, len);
nanocoap_close(&sock);
return res;
return nanocoap_request(pkt, NULL, &remote, len);
}
int nanotest_client_cmd(int argc, char **argv)

View File

@ -98,19 +98,13 @@ static int _parse_ipv6_addr(char *addr_str, ipv6_addr_t *addr, uint16_t *netif)
static ssize_t _send(coap_pkt_t *pkt, size_t len, ipv6_addr_t *addr, uint16_t netif, uint16_t port)
{
sock_udp_ep_t remote;
sock_udp_t sock;
ssize_t res;
remote.family = AF_INET6;
remote.port = port;
remote.netif = netif;
memcpy(&remote.addr.ipv6[0], addr->u8, sizeof(addr->u8));
nanocoap_connect(&sock, NULL, &remote);
res = nanocoap_request(&sock, pkt, len);
nanocoap_close(&sock);
return res;
return nanocoap_request(pkt, NULL, &remote, len);
}
static ssize_t _build_coap_pkt(coap_pkt_t *pkt, uint8_t *buf, ssize_t buflen,