Skip to content

Delaying message id random initialization to later stage. #11484

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Sep 16, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions features/frameworks/mbed-coap/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
# Change Log

## [v5.1.1](https://github.com/ARMmbed/mbed-coap/releases/tag/v5.1.1)

- Delay the random initialization of message id to a later phase and not during init() so there is enough time
for system to complete the rest of the initialization.

-[Full Changelog](https://github.com/ARMmbed/mbed-coap/compare/v5.1.0...v5.1.1)


## [v5.1.0](https://github.com/ARMmbed/mbed-coap/releases/tag/v5.1.0)

- Introduce SN_COAP_REDUCE_BLOCKWISE_HEAP_FOOTPRINT configuration flag.
Expand Down
13 changes: 6 additions & 7 deletions features/frameworks/mbed-coap/source/sn_coap_protocol.c
Original file line number Diff line number Diff line change
Expand Up @@ -179,13 +179,7 @@ struct coap_s *sn_coap_protocol_init(void *(*used_malloc_func_ptr)(uint16_t), vo

#endif /* ENABLE_RESENDINGS */

/* Randomize global message ID */
randLIB_seed_random();
message_id = randLIB_get_16bit();
if (message_id == 0) {
message_id = 1;
}

message_id = 0;
return handle;
}

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

static uint16_t get_new_message_id(void)
{
if (message_id == 0) {
/* Randomize global message ID */
randLIB_seed_random();
message_id = randLIB_get_16bit();
}
message_id++;
if (message_id == 0) {
message_id = 1;
Expand Down