| diff --git a/repo/Makefile.am b/repo/Makefile.am |
| index 15e4881..fe467ec 100644 |
| --- a/repo/Makefile.am |
| +++ b/repo/Makefile.am |
| @@ -174,6 +174,8 @@ distclean-local: |
| ## Ensure we have actual *.{map,sym} files if we create a release tarball. |
| dist-local: update-map-file |
| |
| +$(lib_LTLIBRARIES): libcoap-$(LIBCOAP_API_VERSION).map libcoap-$(LIBCOAP_API_VERSION).sym |
| + |
| ## Finaly some phony targets, just to ensure those targets are always buildable |
| ## no matter if the user has created same called files. |
| .PHONY: update-map-file check_ctags |
| diff --git a/repo/libcoap-1.map b/repo/libcoap-1.map |
| deleted file mode 100644 |
| index 361f43c..0000000 |
| --- a/repo/libcoap-1.map |
| +++ /dev/null |
| @@ -1,118 +0,0 @@ |
| -VER_1 { |
| -global: |
| - coap_add_attr; |
| - coap_add_block; |
| - coap_add_data; |
| - coap_add_observer; |
| - coap_add_option; |
| - coap_add_option_later; |
| - coap_add_resource; |
| - coap_address_equals; |
| - coap_add_token; |
| - coap_adjust_basetime; |
| - coap_cancel_all_messages; |
| - coap_can_exit; |
| - coap_check_notify; |
| - coap_check_option; |
| - coap_clock_init; |
| - coap_clone_uri; |
| - coap_decode_var_bytes; |
| - coap_delete_all; |
| - coap_delete_all_resources; |
| - coap_delete_attr; |
| - coap_delete_node; |
| - coap_delete_observer; |
| - coap_delete_pdu; |
| - coap_delete_resource; |
| - coap_delete_string; |
| - coap_dispatch; |
| - coap_encode_var_bytes; |
| - coap_find_async; |
| - coap_find_attr; |
| - coap_find_observer; |
| - coap_find_transaction; |
| - coap_fls; |
| - coap_flsll; |
| - coap_free_async; |
| - coap_free_context; |
| - coap_free_endpoint; |
| - coap_free_packet; |
| - coap_free_type; |
| - coap_get_block; |
| - coap_get_data; |
| - coap_get_log_level; |
| - coap_get_resource_from_key; |
| - coap_handle_failed_notify; |
| - coap_handle_message; |
| - coap_hash_impl; |
| - coap_hash_path; |
| - coap_hash_request_uri; |
| - coap_insert_node; |
| - coap_is_mcast; |
| - coap_log_impl; |
| - coap_malloc_type; |
| - coap_memory_init; |
| - coap_network_read; |
| - coap_network_send; |
| - coap_new_context; |
| - coap_new_endpoint; |
| - coap_new_error_response; |
| - coap_new_node; |
| - coap_new_pdu; |
| - coap_new_string; |
| - coap_new_uri; |
| - coap_opt_block_num; |
| - coap_opt_delta; |
| - coap_opt_encode; |
| - coap_option_check_critical; |
| - coap_option_filter_get; |
| - coap_option_filter_set; |
| - coap_option_filter_unset; |
| - coap_option_iterator_init; |
| - coap_option_next; |
| - coap_opt_length; |
| - coap_opt_parse; |
| - coap_opt_setheader; |
| - coap_opt_size; |
| - coap_opt_value; |
| - coap_package_name; |
| - coap_package_version; |
| - coap_packet_copy_source; |
| - coap_packet_get_memmapped; |
| - coap_packet_populate_endpoint; |
| - coap_pdu_clear; |
| - coap_pdu_init; |
| - coap_pdu_parse; |
| - coap_peek_next; |
| - coap_pop_next; |
| - coap_print_addr; |
| - coap_print_link; |
| - coap_print_wellknown; |
| - coap_read; |
| - coap_register_async; |
| - coap_remove_async; |
| - coap_remove_from_queue; |
| - coap_resource_init; |
| - coap_response_phrase; |
| - coap_retransmit; |
| - coap_send; |
| - coap_send_ack; |
| - coap_send_confirmed; |
| - coap_send_error; |
| - coap_send_message_type; |
| - coap_set_log_level; |
| - coap_show_pdu; |
| - coap_split_path; |
| - coap_split_query; |
| - coap_split_uri; |
| - coap_subscription_init; |
| - coap_ticks; |
| - coap_ticks; |
| - coap_ticks_to_rt; |
| - coap_touch_observer; |
| - coap_transaction_id; |
| - coap_wellknown_response; |
| - coap_write_block_opt; |
| -local: |
| - *; |
| -}; |
| diff --git a/repo/libcoap-1.sym b/repo/libcoap-1.sym |
| deleted file mode 100644 |
| index b910538..0000000 |
| --- a/repo/libcoap-1.sym |
| +++ /dev/null |
| @@ -1,113 +0,0 @@ |
| -coap_add_attr |
| -coap_add_block |
| -coap_add_data |
| -coap_add_observer |
| -coap_add_option |
| -coap_add_option_later |
| -coap_add_resource |
| -coap_address_equals |
| -coap_add_token |
| -coap_adjust_basetime |
| -coap_cancel_all_messages |
| -coap_can_exit |
| -coap_check_notify |
| -coap_check_option |
| -coap_clock_init |
| -coap_clone_uri |
| -coap_decode_var_bytes |
| -coap_delete_all |
| -coap_delete_all_resources |
| -coap_delete_attr |
| -coap_delete_node |
| -coap_delete_observer |
| -coap_delete_pdu |
| -coap_delete_resource |
| -coap_delete_string |
| -coap_dispatch |
| -coap_encode_var_bytes |
| -coap_find_async |
| -coap_find_attr |
| -coap_find_observer |
| -coap_find_transaction |
| -coap_fls |
| -coap_flsll |
| -coap_free_async |
| -coap_free_context |
| -coap_free_endpoint |
| -coap_free_packet |
| -coap_free_type |
| -coap_get_block |
| -coap_get_data |
| -coap_get_log_level |
| -coap_get_resource_from_key |
| -coap_handle_failed_notify |
| -coap_handle_message |
| -coap_hash_impl |
| -coap_hash_path |
| -coap_hash_request_uri |
| -coap_insert_node |
| -coap_is_mcast |
| -coap_log_impl |
| -coap_malloc_type |
| -coap_memory_init |
| -coap_network_read |
| -coap_network_send |
| -coap_new_context |
| -coap_new_endpoint |
| -coap_new_error_response |
| -coap_new_node |
| -coap_new_pdu |
| -coap_new_string |
| -coap_new_uri |
| -coap_opt_block_num |
| -coap_opt_delta |
| -coap_opt_encode |
| -coap_option_check_critical |
| -coap_option_filter_get |
| -coap_option_filter_set |
| -coap_option_filter_unset |
| -coap_option_iterator_init |
| -coap_option_next |
| -coap_opt_length |
| -coap_opt_parse |
| -coap_opt_setheader |
| -coap_opt_size |
| -coap_opt_value |
| -coap_package_name |
| -coap_package_version |
| -coap_packet_copy_source |
| -coap_packet_get_memmapped |
| -coap_packet_populate_endpoint |
| -coap_pdu_clear |
| -coap_pdu_init |
| -coap_pdu_parse |
| -coap_peek_next |
| -coap_pop_next |
| -coap_print_addr |
| -coap_print_link |
| -coap_print_wellknown |
| -coap_read |
| -coap_register_async |
| -coap_remove_async |
| -coap_remove_from_queue |
| -coap_resource_init |
| -coap_response_phrase |
| -coap_retransmit |
| -coap_send |
| -coap_send_ack |
| -coap_send_confirmed |
| -coap_send_error |
| -coap_send_message_type |
| -coap_set_log_level |
| -coap_show_pdu |
| -coap_split_path |
| -coap_split_query |
| -coap_split_uri |
| -coap_subscription_init |
| -coap_ticks |
| -coap_ticks |
| -coap_ticks_to_rt |
| -coap_touch_observer |
| -coap_transaction_id |
| -coap_wellknown_response |
| -coap_write_block_opt |
| diff --git a/repo/src/net.c b/repo/src/net.c |
| index a549395..2566003 100644 |
| --- a/repo/src/net.c |
| +++ b/repo/src/net.c |
| @@ -1535,19 +1535,43 @@ handle_request(coap_context_t *context, coap_queue_t *node) { |
| assert(response == NULL); |
| } |
| |
| +static inline int |
| +is_separate(const coap_queue_t *node) { |
| + return node->retransmit_cnt > COAP_DEFAULT_MAX_RETRANSMIT; |
| +} |
| + |
| +static int |
| +coap_find_separate_from_queue(coap_context_t *context, const coap_address_t *dst, |
| + const unsigned char *token, size_t token_length, coap_queue_t **sent) { |
| + coap_queue_t *p = NULL; |
| + for (p = context->sendqueue; p; p = p->next) |
| + if (coap_address_equals(dst, &p->remote) && |
| + token_match(token, token_length, |
| + p->pdu->hdr->token, |
| + p->pdu->hdr->token_length) && |
| + is_separate(p)) { |
| + *sent = p; |
| + return 1; |
| + } |
| + return 0; |
| +} |
| + |
| static inline void |
| handle_response(coap_context_t *context, |
| coap_queue_t *sent, coap_queue_t *rcvd) { |
| |
| coap_send_ack(context, &rcvd->local_if, &rcvd->remote, rcvd->pdu); |
| - |
| - /* In a lossy context, the ACK of a separate response may have |
| - * been lost, so we need to stop retransmitting requests with the |
| - * same token. |
| + |
| + /* In case of separate response, the request cannot be matched with |
| + * transaction id which is based on message id and remote address. |
| + * Besides, excludes type Acknowledgement since separate response |
| + * cannot be be of that type. |
| */ |
| - coap_cancel_all_messages(context, &rcvd->remote, |
| - rcvd->pdu->hdr->token, |
| - rcvd->pdu->hdr->token_length); |
| + if (sent == NULL && rcvd->pdu->hdr->type != COAP_MESSAGE_ACK) { |
| + coap_find_separate_from_queue(context, &rcvd->remote, |
| + rcvd->pdu->hdr->token, |
| + rcvd->pdu->hdr->token_length, &sent); |
| + } |
| |
| /* Call application-specific response handler when available. */ |
| if (context->response_handler) { |
| @@ -1555,6 +1579,14 @@ handle_response(coap_context_t *context, |
| &rcvd->remote, sent ? sent->pdu : NULL, |
| rcvd->pdu, rcvd->id); |
| } |
| + |
| + /* In a lossy context, the ACK of a separate response may have |
| + * been lost, so we need to stop retransmitting requests with the |
| + * same token. |
| + */ |
| + coap_cancel_all_messages(context, &rcvd->remote, |
| + rcvd->pdu->hdr->token, |
| + rcvd->pdu->hdr->token_length); |
| } |
| |
| void |
| @@ -1580,8 +1612,15 @@ coap_dispatch(coap_context_t *context, coap_queue_t *rcvd) { |
| /* find transaction in sendqueue to stop retransmission */ |
| coap_remove_from_queue(&context->sendqueue, rcvd->id, &sent); |
| |
| - if (rcvd->pdu->hdr->code == 0) |
| + if (rcvd->pdu->hdr->code == 0) { |
| + if (sent != NULL) { |
| + sent->retransmit_cnt = COAP_DEFAULT_MAX_RETRANSMIT + 1; |
| + sent->t = sent->timeout << COAP_DEFAULT_MAX_RETRANSMIT; |
| + coap_insert_node(&context->sendqueue, sent); |
| + sent = NULL; |
| + } |
| goto cleanup; |
| + } |
| |
| /* if sent code was >= 64 the message might have been a |
| * notification. Then, we must flag the observer to be alive |