Skip to content

Commit d0686fd

Browse files
authored
Merge pull request #11484 from yogpan01/mbed-coap-v5.1.1
Delaying message id random initialization to later stage.
2 parents f5dd7db + 246f431 commit d0686fd

File tree

2 files changed

+14
-7
lines changed

2 files changed

+14
-7
lines changed

features/frameworks/mbed-coap/CHANGELOG.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,13 @@
11
# Change Log
22

3+
## [v5.1.1](https://github.com/ARMmbed/mbed-coap/releases/tag/v5.1.1)
4+
5+
- Delay the random initialization of message id to a later phase and not during init() so there is enough time
6+
for system to complete the rest of the initialization.
7+
8+
-[Full Changelog](https://github.com/ARMmbed/mbed-coap/compare/v5.1.0...v5.1.1)
9+
10+
311
## [v5.1.0](https://github.com/ARMmbed/mbed-coap/releases/tag/v5.1.0)
412

513
- Introduce SN_COAP_REDUCE_BLOCKWISE_HEAP_FOOTPRINT configuration flag.

features/frameworks/mbed-coap/source/sn_coap_protocol.c

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -179,13 +179,7 @@ struct coap_s *sn_coap_protocol_init(void *(*used_malloc_func_ptr)(uint16_t), vo
179179

180180
#endif /* ENABLE_RESENDINGS */
181181

182-
/* Randomize global message ID */
183-
randLIB_seed_random();
184-
message_id = randLIB_get_16bit();
185-
if (message_id == 0) {
186-
message_id = 1;
187-
}
188-
182+
message_id = 0;
189183
return handle;
190184
}
191185

@@ -2526,6 +2520,11 @@ static bool compare_address_and_port(const sn_nsdl_addr_s* left, const sn_nsdl_a
25262520

25272521
static uint16_t get_new_message_id(void)
25282522
{
2523+
if (message_id == 0) {
2524+
/* Randomize global message ID */
2525+
randLIB_seed_random();
2526+
message_id = randLIB_get_16bit();
2527+
}
25292528
message_id++;
25302529
if (message_id == 0) {
25312530
message_id = 1;

0 commit comments

Comments
 (0)