diff options
author | t3sserakt <t3ss@posteo.de> | 2024-01-25 08:39:55 +0100 |
---|---|---|
committer | t3sserakt <t3ss@posteo.de> | 2024-01-25 09:31:22 +0100 |
commit | 5f566289dc905c68309a07e990164049d36d0a9b (patch) | |
tree | cf5bf7d8fb53b14532121a0d67f8f1522b1e4f5a | |
parent | cbc5803322f9dd5b8e1c9850bdf8305c37eb63da (diff) | |
download | gnunet-5f566289dc905c68309a07e990164049d36d0a9b.tar.gz gnunet-5f566289dc905c68309a07e990164049d36d0a9b.zip |
Fixed bug in logic releasing resources and notifying communicators after caching messages to core.
-rw-r--r-- | src/service/transport/gnunet-service-transport.c | 41 |
1 files changed, 26 insertions, 15 deletions
diff --git a/src/service/transport/gnunet-service-transport.c b/src/service/transport/gnunet-service-transport.c index 4ec59822b..bc7364838 100644 --- a/src/service/transport/gnunet-service-transport.c +++ b/src/service/transport/gnunet-service-transport.c | |||
@@ -1200,7 +1200,7 @@ struct CommunicatorMessageContext | |||
1200 | uint16_t total_hops; | 1200 | uint16_t total_hops; |
1201 | 1201 | ||
1202 | /** | 1202 | /** |
1203 | * Did we already call GNUNET_SERVICE_client_continue? | 1203 | * Did we already call GNUNET_SERVICE_client_continue and send ACK to communicator? |
1204 | */ | 1204 | */ |
1205 | unsigned int continue_send; | 1205 | unsigned int continue_send; |
1206 | }; | 1206 | }; |
@@ -4144,7 +4144,7 @@ notify_client_connect_info (void *cls, | |||
4144 | static void | 4144 | static void |
4145 | finish_cmc_handling_with_continue (struct CommunicatorMessageContext *cmc, | 4145 | finish_cmc_handling_with_continue (struct CommunicatorMessageContext *cmc, |
4146 | unsigned | 4146 | unsigned |
4147 | int continue_client); | 4147 | int free_cmc); |
4148 | 4148 | ||
4149 | static enum GNUNET_GenericReturnValue | 4149 | static enum GNUNET_GenericReturnValue |
4150 | resume_communicators(void *cls, | 4150 | resume_communicators(void *cls, |
@@ -4158,7 +4158,8 @@ resume_communicators(void *cls, | |||
4158 | while (NULL != (cmc = vl->cmc_tail)) | 4158 | while (NULL != (cmc = vl->cmc_tail)) |
4159 | { | 4159 | { |
4160 | GNUNET_CONTAINER_DLL_remove (vl->cmc_head, vl->cmc_tail, cmc); | 4160 | GNUNET_CONTAINER_DLL_remove (vl->cmc_head, vl->cmc_tail, cmc); |
4161 | finish_cmc_handling_with_continue (cmc, GNUNET_YES == cmc->continue_send ? GNUNET_NO : GNUNET_YES); | 4161 | if (GNUNET_NO == cmc->continue_send) |
4162 | finish_cmc_handling_with_continue (cmc, GNUNET_YES); | ||
4162 | } | 4163 | } |
4163 | return GNUNET_OK; | 4164 | return GNUNET_OK; |
4164 | } | 4165 | } |
@@ -4388,7 +4389,7 @@ check_communicator_available ( | |||
4388 | static void | 4389 | static void |
4389 | finish_cmc_handling_with_continue (struct CommunicatorMessageContext *cmc, | 4390 | finish_cmc_handling_with_continue (struct CommunicatorMessageContext *cmc, |
4390 | unsigned | 4391 | unsigned |
4391 | int continue_client) | 4392 | int free_cmc) |
4392 | { | 4393 | { |
4393 | if (0 != ntohl (cmc->im.fc_on)) | 4394 | if (0 != ntohl (cmc->im.fc_on)) |
4394 | { | 4395 | { |
@@ -4406,11 +4407,12 @@ finish_cmc_handling_with_continue (struct CommunicatorMessageContext *cmc, | |||
4406 | GNUNET_MQ_send (cmc->tc->mq, env); | 4407 | GNUNET_MQ_send (cmc->tc->mq, env); |
4407 | } | 4408 | } |
4408 | 4409 | ||
4409 | if (GNUNET_YES == continue_client) | 4410 | GNUNET_SERVICE_client_continue (cmc->tc->client); |
4411 | |||
4412 | if (GNUNET_YES == free_cmc) | ||
4410 | { | 4413 | { |
4411 | GNUNET_SERVICE_client_continue (cmc->tc->client); | 4414 | GNUNET_free (cmc); |
4412 | } | 4415 | } |
4413 | GNUNET_free (cmc); | ||
4414 | } | 4416 | } |
4415 | 4417 | ||
4416 | 4418 | ||
@@ -4466,7 +4468,8 @@ handle_client_recv_ok (void *cls, const struct RecvOkMessage *rom) | |||
4466 | while (NULL != (cmc = vl->cmc_tail)) | 4468 | while (NULL != (cmc = vl->cmc_tail)) |
4467 | { | 4469 | { |
4468 | GNUNET_CONTAINER_DLL_remove (vl->cmc_head, vl->cmc_tail, cmc); | 4470 | GNUNET_CONTAINER_DLL_remove (vl->cmc_head, vl->cmc_tail, cmc); |
4469 | finish_cmc_handling_with_continue (cmc, GNUNET_YES == cmc->continue_send ? GNUNET_NO : GNUNET_YES); | 4471 | if (GNUNET_NO == cmc->continue_send) |
4472 | finish_cmc_handling_with_continue (cmc, GNUNET_YES); | ||
4470 | } | 4473 | } |
4471 | } | 4474 | } |
4472 | 4475 | ||
@@ -5682,6 +5685,7 @@ shc_cont (void *cls, int success) | |||
5682 | { | 5685 | { |
5683 | struct AddressListEntry *ale = cls; | 5686 | struct AddressListEntry *ale = cls; |
5684 | struct GNUNET_TIME_Absolute expiration; | 5687 | struct GNUNET_TIME_Absolute expiration; |
5688 | |||
5685 | expiration = GNUNET_TIME_relative_to_absolute (ale->expiration); | 5689 | expiration = GNUNET_TIME_relative_to_absolute (ale->expiration); |
5686 | ale->sc = GNUNET_PEERSTORE_store (peerstore, | 5690 | ale->sc = GNUNET_PEERSTORE_store (peerstore, |
5687 | "transport", | 5691 | "transport", |
@@ -5885,7 +5889,7 @@ static void | |||
5885 | finish_handling_raw_message (struct VirtualLink *vl, | 5889 | finish_handling_raw_message (struct VirtualLink *vl, |
5886 | const struct GNUNET_MessageHeader *mh, | 5890 | const struct GNUNET_MessageHeader *mh, |
5887 | struct CommunicatorMessageContext *cmc, | 5891 | struct CommunicatorMessageContext *cmc, |
5888 | unsigned int continue_client) | 5892 | unsigned int free_cmc) |
5889 | { | 5893 | { |
5890 | uint16_t size = ntohs (mh->size); | 5894 | uint16_t size = ntohs (mh->size); |
5891 | int have_core; | 5895 | int have_core; |
@@ -5900,7 +5904,8 @@ finish_handling_raw_message (struct VirtualLink *vl, | |||
5900 | "CORE messages of type %u with %u bytes dropped (FC arithmetic overflow)\n", | 5904 | "CORE messages of type %u with %u bytes dropped (FC arithmetic overflow)\n", |
5901 | (unsigned int) ntohs (mh->type), | 5905 | (unsigned int) ntohs (mh->type), |
5902 | (unsigned int) ntohs (mh->size)); | 5906 | (unsigned int) ntohs (mh->size)); |
5903 | finish_cmc_handling_with_continue (cmc, continue_client); | 5907 | if (GNUNET_YES == free_cmc) |
5908 | finish_cmc_handling_with_continue (cmc, GNUNET_YES); | ||
5904 | return; | 5909 | return; |
5905 | } | 5910 | } |
5906 | if (vl->incoming_fc_window_size_ram + size > vl->available_fc_window_size) | 5911 | if (vl->incoming_fc_window_size_ram + size > vl->available_fc_window_size) |
@@ -5913,7 +5918,8 @@ finish_handling_raw_message (struct VirtualLink *vl, | |||
5913 | "CORE messages of type %u with %u bytes dropped (FC window overflow)\n", | 5918 | "CORE messages of type %u with %u bytes dropped (FC window overflow)\n", |
5914 | (unsigned int) ntohs (mh->type), | 5919 | (unsigned int) ntohs (mh->type), |
5915 | (unsigned int) ntohs (mh->size)); | 5920 | (unsigned int) ntohs (mh->size)); |
5916 | finish_cmc_handling_with_continue (cmc, continue_client); | 5921 | if (GNUNET_YES == free_cmc) |
5922 | finish_cmc_handling_with_continue (cmc, GNUNET_YES); | ||
5917 | return; | 5923 | return; |
5918 | } | 5924 | } |
5919 | 5925 | ||
@@ -5953,7 +5959,8 @@ finish_handling_raw_message (struct VirtualLink *vl, | |||
5953 | "Dropped message of type %u with %u bytes to CORE: no CORE client connected!\n", | 5959 | "Dropped message of type %u with %u bytes to CORE: no CORE client connected!\n", |
5954 | (unsigned int) ntohs (mh->type), | 5960 | (unsigned int) ntohs (mh->type), |
5955 | (unsigned int) ntohs (mh->size)); | 5961 | (unsigned int) ntohs (mh->size)); |
5956 | finish_cmc_handling_with_continue (cmc, continue_client); | 5962 | if (GNUNET_YES == free_cmc) |
5963 | finish_cmc_handling_with_continue (cmc, GNUNET_YES); | ||
5957 | return; | 5964 | return; |
5958 | } | 5965 | } |
5959 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 5966 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
@@ -5963,12 +5970,14 @@ finish_handling_raw_message (struct VirtualLink *vl, | |||
5963 | vl->core_recv_window); | 5970 | vl->core_recv_window); |
5964 | if (vl->core_recv_window > 0) | 5971 | if (vl->core_recv_window > 0) |
5965 | { | 5972 | { |
5966 | finish_cmc_handling_with_continue (cmc, continue_client); | 5973 | if (GNUNET_YES == free_cmc) |
5974 | finish_cmc_handling_with_continue (cmc, GNUNET_YES); | ||
5967 | return; | 5975 | return; |
5968 | } | 5976 | } |
5969 | /* Wait with calling #finish_cmc_handling(cmc) until the message | 5977 | /* Wait with calling #finish_cmc_handling(cmc) until the message |
5970 | was processed by CORE MQs (for CORE flow control)! */ | 5978 | was processed by CORE MQs (for CORE flow control)! */ |
5971 | GNUNET_CONTAINER_DLL_insert (vl->cmc_head, vl->cmc_tail, cmc); | 5979 | if (GNUNET_YES == free_cmc) |
5980 | GNUNET_CONTAINER_DLL_insert (vl->cmc_head, vl->cmc_tail, cmc); | ||
5972 | } | 5981 | } |
5973 | 5982 | ||
5974 | 5983 | ||
@@ -6029,6 +6038,7 @@ handle_raw_message (void *cls, const struct GNUNET_MessageHeader *mh) | |||
6029 | if (GNUNET_YES == is_ring_buffer_full) | 6038 | if (GNUNET_YES == is_ring_buffer_full) |
6030 | { | 6039 | { |
6031 | struct RingBufferEntry *rbe_old = ring_buffer[ring_buffer_head]; | 6040 | struct RingBufferEntry *rbe_old = ring_buffer[ring_buffer_head]; |
6041 | GNUNET_free (rbe_old->cmc); | ||
6032 | GNUNET_free (rbe_old->mh); | 6042 | GNUNET_free (rbe_old->mh); |
6033 | GNUNET_free (rbe_old); | 6043 | GNUNET_free (rbe_old); |
6034 | } | 6044 | } |
@@ -6066,7 +6076,7 @@ handle_raw_message (void *cls, const struct GNUNET_MessageHeader *mh) | |||
6066 | (unsigned int) ntohs (mh->type), | 6076 | (unsigned int) ntohs (mh->type), |
6067 | (unsigned int) ntohs (mh->size)); | 6077 | (unsigned int) ntohs (mh->size)); |
6068 | finish_cmc_handling (cmc);*/ | 6078 | finish_cmc_handling (cmc);*/ |
6069 | GNUNET_SERVICE_client_continue (cmc->tc->client); | 6079 | finish_cmc_handling_with_continue (cmc, GNUNET_NO); |
6070 | cmc->continue_send = GNUNET_YES; | 6080 | cmc->continue_send = GNUNET_YES; |
6071 | // GNUNET_free (cmc); | 6081 | // GNUNET_free (cmc); |
6072 | return; | 6082 | return; |
@@ -6975,6 +6985,7 @@ send_msg_from_cache (struct VirtualLink *vl) | |||
6975 | (unsigned int) ntohs (mh->size)); | 6985 | (unsigned int) ntohs (mh->size)); |
6976 | finish_handling_raw_message (vl, mh, cmc, GNUNET_NO); | 6986 | finish_handling_raw_message (vl, mh, cmc, GNUNET_NO); |
6977 | GNUNET_free (mh); | 6987 | GNUNET_free (mh); |
6988 | GNUNET_free (rbe->cmc); | ||
6978 | GNUNET_free (rbe); | 6989 | GNUNET_free (rbe); |
6979 | } | 6990 | } |
6980 | else | 6991 | else |