mirror of
https://github.com/obgm/libcoap.git
synced 2026-11-21 06:49:05 +03:00
coap-server.c: Fix async query updating delay
This commit is contained in:
1 parent
74f1858cfb
commit
96c774de36
1 file changed
+12
-3
+12
-3
@@ -386,11 +386,20 @@ hnd_get_async(coap_resource_t *resource,
|
||||
if (!async) {
|
||||
/* Set up an async request to trigger delay in the future */
|
||||
if (query) {
|
||||
/* Expect the query to just be the number of seconds to delay */
|
||||
const uint8_t *p = query->s;
|
||||
|
||||
delay = 0;
|
||||
for (size = query->length; size; --size, ++p)
|
||||
delay = delay * 10 + (*p - '0');
|
||||
if (isdigit(*p)) {
|
||||
delay = 0;
|
||||
for (size = query->length; size; --size, ++p) {
|
||||
if (!isdigit(*p))
|
||||
break;
|
||||
delay = delay * 10 + (*p - '0');
|
||||
}
|
||||
} else {
|
||||
coap_log_debug(
|
||||
"async: query is just a number of seconds to alter delay\n");
|
||||
}
|
||||
if (delay == 0) {
|
||||
coap_log(LOG_INFO, "async: delay of 0 not supported\n");
|
||||
coap_pdu_set_code(response, COAP_RESPONSE_CODE_BAD_REQUEST);
|
||||
|
||||
Reference in new issue
Block a user