Skip to content

Commit cfef06a

Browse files
maxd-nordicrlubos
authored andcommitted
net: nrf_cloud_coap: kconfig for max_retries
Add a Kconfig option to set the maximum number of CoAP request retries. Signed-off-by: Maximilian Deubel <[email protected]>
1 parent 84661e7 commit cfef06a

File tree

3 files changed

+9
-2
lines changed

3 files changed

+9
-2
lines changed

doc/nrf/releases_and_maturity/releases/release-notes-changelog.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -855,6 +855,7 @@ Libraries for networking
855855

856856
* Added
857857

858+
* The :kconfig:option:`CONFIG_NRF_CLOUD_COAP_MAX_RETRIES` Kconfig option to configure the maximum number of retries for CoAP requests.
858859
* The :kconfig:option:`CONFIG_NRF_PROVISIONING_INITIAL_BACKOFF` Kconfig option to configure the initial backoff time for provisioning retries.
859860
* The :kconfig:option:`CONFIG_NRF_PROVISIONING_STACK_SIZE` Kconfig option to configure the stack size of the provisioning thread.
860861
* A new query parameter to limit the number of provisioning commands included in a single provisioning request.

subsys/net/lib/nrf_cloud/Kconfig.nrf_cloud_coap

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,13 @@ config NRF_CLOUD_COAP_KEEPOPEN
5151
Improve benefit from using DTLS Connection ID by keeping the socket
5252
open when temporary LTE PDN connection loss occurs.
5353

54+
config NRF_CLOUD_COAP_MAX_RETRIES
55+
int "Maximum number of CoAP request retries"
56+
default 10
57+
help
58+
The maximum number of times a CoAP request will be retried before it is considered failed.
59+
A value of 0 means that no retries will be attempted.
60+
5461
if WIFI
5562

5663
config NRF_CLOUD_COAP_SEND_SSIDS

subsys/net/lib/nrf_cloud/coap/src/nrf_cloud_coap_transport.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,6 @@ LOG_MODULE_REGISTER(nrf_cloud_coap_transport, CONFIG_NRF_CLOUD_COAP_LOG_LEVEL);
4545
/** @TODO: figure out whether to make this a Kconfig value or place in a header */
4646
#define CDDL_VERSION "1"
4747
#define MAX_COAP_PATH 256
48-
#define MAX_RETRIES 10
4948
#define JWT_BUF_SZ 700
5049
#define VER_STRING_FMT "mver=%s&cver=%s&dver=%s"
5150
#define VER_STRING_FMT2 "cver=" CDDL_VERSION "&dver=" BUILD_VERSION_STR
@@ -482,7 +481,7 @@ static int client_transfer(enum coap_method method,
482481
/* -EAGAIN means the CoAP client is currently waiting for a response
483482
* to a previous request (likely started in a separate thread).
484483
*/
485-
if (retry++ > MAX_RETRIES) {
484+
if (retry++ > CONFIG_NRF_CLOUD_COAP_MAX_RETRIES) {
486485
LOG_ERR("Timeout waiting for CoAP client to be available");
487486
err = -ETIMEDOUT;
488487
goto transfer_end;

0 commit comments

Comments
 (0)