Skip to content

Commit 945d75f

Browse files
authored
Merge pull request #5833 from anttiylitokola/get_req_change
Add token to every GET(block2) request
2 parents f1ecb51 + 3e5a4f0 commit 945d75f

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

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

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1903,6 +1903,16 @@ static sn_coap_hdr_s *sn_coap_handle_blockwise_message(struct coap_s *handle, sn
19031903
}
19041904
memcpy(src_coap_blockwise_ack_msg_ptr->uri_path_ptr, previous_blockwise_msg_ptr->coap_msg_ptr->uri_path_ptr, previous_blockwise_msg_ptr->coap_msg_ptr->uri_path_len);
19051905
}
1906+
if (previous_blockwise_msg_ptr->coap_msg_ptr->token_ptr) {
1907+
src_coap_blockwise_ack_msg_ptr->token_len = previous_blockwise_msg_ptr->coap_msg_ptr->token_len;
1908+
src_coap_blockwise_ack_msg_ptr->token_ptr = handle->sn_coap_protocol_malloc(previous_blockwise_msg_ptr->coap_msg_ptr->token_len);
1909+
if (!src_coap_blockwise_ack_msg_ptr->token_ptr) {
1910+
sn_coap_parser_release_allocated_coap_msg_mem(handle, src_coap_blockwise_ack_msg_ptr);
1911+
tr_error("sn_coap_handle_blockwise_message - failed to allocate for token ptr!");
1912+
return NULL;
1913+
}
1914+
memcpy(src_coap_blockwise_ack_msg_ptr->token_ptr, previous_blockwise_msg_ptr->coap_msg_ptr->token_ptr, previous_blockwise_msg_ptr->coap_msg_ptr->token_len);
1915+
}
19061916
}
19071917

19081918
ns_list_remove(&handle->linked_list_blockwise_sent_msgs, previous_blockwise_msg_ptr);

0 commit comments

Comments
 (0)