1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2025-12-25 14:33:52 +01:00

Merge pull request #18242 from benpicco/nanocoap-debug

nanocoap_sock: fix debug output
This commit is contained in:
Marian Buschsieweke 2022-06-22 13:54:24 +02:00 committed by GitHub
commit b2ff5b02bd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 7 deletions

View File

@ -173,8 +173,10 @@ ssize_t nanocoap_sock_request_cb(nanocoap_sock_t *sock, coap_pkt_t *pkt,
/* fall-through */
case STATE_RESPONSE_RCVD:
case STATE_RESPONSE_OK:
DEBUG("nanocoap: waiting for response (timeout: %"PRIu32" µs)\n",
_deadline_left_us(deadline));
if (ctx == NULL) {
DEBUG("nanocoap: waiting for response (timeout: %"PRIu32" µs)\n",
_deadline_left_us(deadline));
}
const void *old_ctx = ctx;
tmp = sock_udp_recv_buf(sock, &payload, &ctx, _deadline_left_us(deadline), NULL);
/* sock_udp_recv_buf() is supposed to return multiple packet fragments
@ -198,7 +200,7 @@ ssize_t nanocoap_sock_request_cb(nanocoap_sock_t *sock, coap_pkt_t *pkt,
}
res = tmp;
if (res == -ETIMEDOUT) {
DEBUG("nanocoap: timeout\n");
DEBUG("nanocoap: timeout, %u retries left\n", tries_left - 1);
timeout *= 2;
deadline = _deadline_from_interval(timeout);
state = STATE_REQUEST_SEND;

View File

@ -66,12 +66,12 @@ int nanocoap_vfs_get(nanocoap_sock_t *sock, const char *path, const char *dst)
int fd, res;
char dst_tmp[CONFIG_SOCK_URLPATH_MAXLEN];
DEBUG("nanocoap: downloading %s to %s\n", path, dst_tmp);
fd = _prepare_file(dst, dst_tmp, sizeof(dst_tmp));
if (fd < 0) {
return fd;
}
DEBUG("nanocoap: downloading %s to %s\n", path, dst_tmp);
res = nanocoap_sock_get_blockwise(sock, path, CONFIG_NANOCOAP_BLOCKSIZE_DEFAULT,
_2file, &fd);
return _finalize_file(fd, res, dst, dst_tmp);
@ -82,12 +82,12 @@ int nanocoap_vfs_get_url(const char *url, const char *dst)
int fd, res;
char dst_tmp[CONFIG_SOCK_URLPATH_MAXLEN];
DEBUG("nanocoap: downloading %s to %s\n", url, dst_tmp);
fd = _prepare_file(dst, dst_tmp, sizeof(dst_tmp));
if (fd < 0) {
return fd;
}
DEBUG("nanocoap: downloading %s to %s\n", url, dst_tmp);
res = nanocoap_get_blockwise_url(url, CONFIG_NANOCOAP_BLOCKSIZE_DEFAULT,
_2file, &fd);
return _finalize_file(fd, res, dst, dst_tmp);