samples: net: coap_server: Finetune sample parameters
Finetune coap_server sample parameters for better user experience. Reduce the maximum retransmission count to release resources earilier in case client is unreachable and no longer responds. Increase the maximum number of pending retransmissions, along with the heap size (the buffers for messages are allocated on a heap), to improve sample responsiveness, in case multiple unreplied messages are pending retransmission. Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
This commit is contained in:
parent
15ba020343
commit
eca98e37d4
2 changed files with 5 additions and 4 deletions
|
@ -24,7 +24,7 @@ CONFIG_NET_LOG=y
|
||||||
CONFIG_NET_SHELL=y
|
CONFIG_NET_SHELL=y
|
||||||
|
|
||||||
CONFIG_MAIN_STACK_SIZE=2048
|
CONFIG_MAIN_STACK_SIZE=2048
|
||||||
CONFIG_HEAP_MEM_POOL_SIZE=2048
|
CONFIG_HEAP_MEM_POOL_SIZE=4096
|
||||||
|
|
||||||
# Configuration
|
# Configuration
|
||||||
CONFIG_NET_CONFIG_SETTINGS=y
|
CONFIG_NET_CONFIG_SETTINGS=y
|
||||||
|
|
|
@ -24,6 +24,8 @@ LOG_MODULE_REGISTER(net_coap_server_sample, LOG_LEVEL_DBG);
|
||||||
#include "ipv6.h"
|
#include "ipv6.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#define MAX_RETRANSMIT_COUNT 2
|
||||||
|
|
||||||
#define MAX_COAP_MSG_LEN 256
|
#define MAX_COAP_MSG_LEN 256
|
||||||
|
|
||||||
#define MY_COAP_PORT 5683
|
#define MY_COAP_PORT 5683
|
||||||
|
@ -44,7 +46,7 @@ LOG_MODULE_REGISTER(net_coap_server_sample, LOG_LEVEL_DBG);
|
||||||
|
|
||||||
#define NUM_OBSERVERS 3
|
#define NUM_OBSERVERS 3
|
||||||
|
|
||||||
#define NUM_PENDINGS 3
|
#define NUM_PENDINGS 10
|
||||||
|
|
||||||
/* CoAP socket fd */
|
/* CoAP socket fd */
|
||||||
static int sock;
|
static int sock;
|
||||||
|
@ -1020,8 +1022,7 @@ static int create_pending_request(struct coap_packet *response,
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
}
|
}
|
||||||
|
|
||||||
r = coap_pending_init(pending, response, addr,
|
r = coap_pending_init(pending, response, addr, MAX_RETRANSMIT_COUNT);
|
||||||
COAP_DEFAULT_MAX_RETRANSMIT);
|
|
||||||
if (r < 0) {
|
if (r < 0) {
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue