aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authort3sserakt <t3ss@posteo.de>2024-02-05 13:09:15 +0100
committert3sserakt <t3ss@posteo.de>2024-02-05 13:21:01 +0100
commita3b9d9876c4d812f44cbce764c5612f071a83448 (patch)
tree3e7974c38a1ff944783e34e4b9dacc941c889b94 /src
parent3336f8c2544c8a6f2ee12140345c2e8439c11c84 (diff)
downloadgnunet-a3b9d9876c4d812f44cbce764c5612f071a83448.tar.gz
gnunet-a3b9d9876c4d812f44cbce764c5612f071a83448.zip
Core: Fixed fragmentation logic.
Diffstat (limited to 'src')
-rw-r--r--src/service/transport/gnunet-service-transport.c41
1 files changed, 30 insertions, 11 deletions
diff --git a/src/service/transport/gnunet-service-transport.c b/src/service/transport/gnunet-service-transport.c
index d61755890..8c5de96ec 100644
--- a/src/service/transport/gnunet-service-transport.c
+++ b/src/service/transport/gnunet-service-transport.c
@@ -3105,7 +3105,7 @@ free_pending_message (struct PendingMessage *pm)
3105 vl->pending_msg_tail, 3105 vl->pending_msg_tail,
3106 pm); 3106 pm);
3107 } 3107 }
3108 else if (NULL != pm->frag_parent) 3108 else if (NULL != pm->frag_parent && PMT_DV_BOX != pm->pmt)
3109 { 3109 {
3110 struct PendingMessage *root = pm->frag_parent; 3110 struct PendingMessage *root = pm->frag_parent;
3111 3111
@@ -9902,23 +9902,41 @@ reorder_root_pm (struct PendingMessage *pm,
9902 9902
9903 9903
9904static unsigned int 9904static unsigned int
9905check_next_attempt_tree (struct PendingMessage *pm) 9905check_next_attempt_tree (struct PendingMessage *pm, struct PendingMessage *root)
9906{ 9906{
9907 struct PendingMessage *pos; 9907 struct PendingMessage *pos;
9908 enum GNUNET_GenericReturnValue frags_in_flight_round; 9908 enum GNUNET_GenericReturnValue frags_in_flight;
9909 9909
9910 pos = pm->head_frag; 9910 pos = pm->head_frag;
9911 while (NULL != pos) 9911 while (NULL != pos)
9912 { 9912 {
9913 if (pos->frags_in_flight_round == pm->frags_in_flight_round || 9913 if (pos->frags_in_flight_round == pm->frags_in_flight_round ||
9914 GNUNET_YES == check_next_attempt_tree (pos)) 9914 GNUNET_NO == check_next_attempt_tree (pos, root))
9915 frags_in_flight_round = GNUNET_NO; 9915 frags_in_flight = GNUNET_NO;
9916 else 9916 else
9917 frags_in_flight_round = GNUNET_YES; 9917 {
9918 frags_in_flight = GNUNET_YES;
9919 break;
9920 }
9918 pos = pos->next_frag; 9921 pos = pos->next_frag;
9919 } 9922 }
9920 9923
9921 return frags_in_flight_round; 9924 return frags_in_flight;
9925}
9926
9927
9928static void
9929harmonize_flight_round (struct PendingMessage *pm)
9930{
9931 struct PendingMessage *pos;
9932
9933 pos = pm->head_frag;
9934 while (NULL != pos)
9935 {
9936 pos->frags_in_flight_round = pm->frags_in_flight_round;
9937 harmonize_flight_round (pos);
9938 pos = pos->next_frag;
9939 }
9922} 9940}
9923 9941
9924 9942
@@ -9964,12 +9982,13 @@ update_pm_next_attempt (struct PendingMessage *pm,
9964 root = root->frag_parent; 9982 root = root->frag_parent;
9965 9983
9966 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 9984 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
9967 "frag_count %u\n", 9985 "frag_count next atempt %u\n",
9968 root->frag_count); 9986 root->frag_count);
9969 9987
9970 if (GNUNET_NO == root->frags_in_flight) 9988 if (GNUNET_NO == root->frags_in_flight)
9971 { 9989 {
9972 root->next_attempt = next_attempt; 9990 root->next_attempt = next_attempt;
9991 harmonize_flight_round (root);
9973 root->frags_in_flight_round++; 9992 root->frags_in_flight_round++;
9974 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 9993 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
9975 "Next attempt for fragmented message <%" PRIu64 "> (<%" PRIu64 9994 "Next attempt for fragmented message <%" PRIu64 "> (<%" PRIu64
@@ -9981,9 +10000,10 @@ update_pm_next_attempt (struct PendingMessage *pm,
9981 10000
9982 pm->next_attempt = root->next_attempt; 10001 pm->next_attempt = root->next_attempt;
9983 pm->frags_in_flight_round = root->frags_in_flight_round; 10002 pm->frags_in_flight_round = root->frags_in_flight_round;
10003 harmonize_flight_round (pm);
9984 10004
9985 if (root->bytes_msg == root->frag_off) 10005 if (root->bytes_msg == root->frag_off)
9986 root->frags_in_flight = check_next_attempt_tree (root); 10006 root->frags_in_flight = check_next_attempt_tree (root, root);
9987 else 10007 else
9988 root->frags_in_flight = GNUNET_YES; 10008 root->frags_in_flight = GNUNET_YES;
9989 10009
@@ -9997,8 +10017,7 @@ update_pm_next_attempt (struct PendingMessage *pm,
9997 if (PMT_DV_BOX == root->pmt) 10017 if (PMT_DV_BOX == root->pmt)
9998 root = root->frag_parent; 10018 root = root->frag_parent;
9999 reorder_root_pm (root, root->next_attempt); 10019 reorder_root_pm (root, root->next_attempt);
10000 root->frag_count = 0; 10020 //root->next_attempt = GNUNET_TIME_UNIT_ZERO_ABS;
10001 root->next_attempt = GNUNET_TIME_UNIT_ZERO_ABS;
10002 } 10021 }
10003 else 10022 else
10004 { 10023 {