Skip to content

Commit

Permalink
fixup! examples/gcoap[_dtls]: input full URI for request and proxy
Browse files Browse the repository at this point in the history
  • Loading branch information
fabian18 committed Apr 8, 2024
1 parent ff2c51d commit 281e7ca
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions examples/gcoap/client.c
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,8 @@ static size_t obs_req_tkl = 0;
uint16_t req_count = 0;

static gcoap_socket_type_t _get_tl(const char *uri);
static size_t _send(uint8_t *buf, size_t len, const sock_udp_ep_t *remote,
void *ctx, gcoap_socket_type_t tl);
static ssize_t _send(uint8_t *buf, size_t len, const sock_udp_ep_t *remote,
void *ctx, gcoap_socket_type_t tl);

/*
* Response callback.
Expand Down Expand Up @@ -172,10 +172,10 @@ static gcoap_socket_type_t _get_tl(const char *uri)
return GCOAP_SOCKET_TYPE_UNDEF;
}

static size_t _send(uint8_t *buf, size_t len, const sock_udp_ep_t *remote,
void *ctx, gcoap_socket_type_t tl)
static ssize_t _send(uint8_t *buf, size_t len, const sock_udp_ep_t *remote,
void *ctx, gcoap_socket_type_t tl)
{
size_t bytes_sent = gcoap_req_send(buf, len, remote, _resp_handler, ctx, tl);
ssize_t bytes_sent = gcoap_req_send(buf, len, remote, _resp_handler, ctx, tl);
if (bytes_sent > 0) {
req_count++;
}
Expand Down Expand Up @@ -389,8 +389,8 @@ int gcoap_cli_cmd(int argc, char **argv)

printf("gcoap_cli: sending msg ID %u, %" PRIuSIZE " bytes\n",
coap_get_id(&pdu), len);
if (!_send(&buf[0], len, *_proxy_uri ? &_proxy_remote : &remote, NULL,
*_proxy_uri ? _get_tl(_proxy_uri) : _get_tl(_last_req_uri))) {
if (_send(&buf[0], len, *_proxy_uri ? &_proxy_remote : &remote, NULL,
*_proxy_uri ? _get_tl(_proxy_uri) : _get_tl(_last_req_uri)) <= 0) {
puts("gcoap_cli: msg send failed");
}
else {
Expand Down

0 comments on commit 281e7ca

Please sign in to comment.