diff options
author | t3sserakt <t3ss@posteo.de> | 2023-04-27 17:36:27 +0200 |
---|---|---|
committer | t3sserakt <t3ss@posteo.de> | 2023-05-02 12:40:59 +0200 |
commit | 1c95729d2d62f8bd151db2f78d5166a5aec14539 (patch) | |
tree | 070cf30c8da4f657522f1913e58216f31923b26c | |
parent | bc50efd138e39a77620f4154a5466b84e702c6aa (diff) | |
download | gnunet-1c95729d2d62f8bd151db2f78d5166a5aec14539.tar.gz gnunet-1c95729d2d62f8bd151db2f78d5166a5aec14539.zip |
TNG: Introduced frags_in_flight flag. With this flag we check if fragments of a PendingMessage are being send right now, to not resend single fragments, but the PendingMessage at once.
-rw-r--r-- | src/transport/gnunet-service-tng.c | 39 |
1 files changed, 30 insertions, 9 deletions
diff --git a/src/transport/gnunet-service-tng.c b/src/transport/gnunet-service-tng.c index e7acd49f5..6b835a209 100644 --- a/src/transport/gnunet-service-tng.c +++ b/src/transport/gnunet-service-tng.c | |||
@@ -2282,6 +2282,10 @@ struct PendingMessage | |||
2282 | uint16_t frag_off; | 2282 | uint16_t frag_off; |
2283 | 2283 | ||
2284 | /** | 2284 | /** |
2285 | * Are we sending fragments at the moment? | ||
2286 | */ | ||
2287 | unsigned int frags_in_flight; | ||
2288 | /** | ||
2285 | * #GNUNET_YES once @e msg_uuid was initialized | 2289 | * #GNUNET_YES once @e msg_uuid was initialized |
2286 | */ | 2290 | */ |
2287 | int16_t msg_uuid_set; | 2291 | int16_t msg_uuid_set; |
@@ -9627,6 +9631,11 @@ struct PendingMessageScoreContext | |||
9627 | int to_early; | 9631 | int to_early; |
9628 | 9632 | ||
9629 | /** | 9633 | /** |
9634 | * There is a pending messages we are sending fragments at the moment. | ||
9635 | */ | ||
9636 | unsigned int frags_in_flight; | ||
9637 | |||
9638 | /** | ||
9630 | * When will we try to transmit the message again for which it was to early to retry. | 9639 | * When will we try to transmit the message again for which it was to early to retry. |
9631 | */ | 9640 | */ |
9632 | struct GNUNET_TIME_Relative to_early_retry_delay; | 9641 | struct GNUNET_TIME_Relative to_early_retry_delay; |
@@ -9654,6 +9663,8 @@ select_best_pending_from_link (struct PendingMessageScoreContext *sc, | |||
9654 | struct GNUNET_TIME_Absolute now; | 9663 | struct GNUNET_TIME_Absolute now; |
9655 | 9664 | ||
9656 | now = GNUNET_TIME_absolute_get (); | 9665 | now = GNUNET_TIME_absolute_get (); |
9666 | sc->to_early = GNUNET_NO; | ||
9667 | sc->frags_in_flight = GNUNET_NO; | ||
9657 | for (struct PendingMessage *pos = vl->pending_msg_head; NULL != pos; | 9668 | for (struct PendingMessage *pos = vl->pending_msg_head; NULL != pos; |
9658 | pos = pos->next_vl) | 9669 | pos = pos->next_vl) |
9659 | { | 9670 | { |
@@ -9669,15 +9680,25 @@ select_best_pending_from_link (struct PendingMessageScoreContext *sc, | |||
9669 | } | 9680 | } |
9670 | if (pos->next_attempt.abs_value_us > now.abs_value_us) | 9681 | if (pos->next_attempt.abs_value_us > now.abs_value_us) |
9671 | { | 9682 | { |
9672 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 9683 | if (GNUNET_YES == pos->frags_in_flight) |
9673 | "too early for all messages, they are sorted by next_attempt\n"); | 9684 | { |
9674 | sc->to_early = GNUNET_YES; | 9685 | sc->frags_in_flight = GNUNET_YES; |
9675 | sc->to_early_retry_delay = GNUNET_TIME_absolute_get_remaining ( | 9686 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
9676 | pos->next_attempt); | 9687 | "Fragments in flight for message %llu\n", |
9677 | 9688 | pos->logging_uuid); | |
9678 | break; /* too early for all messages, they are sorted by next_attempt */ | 9689 | } |
9690 | else | ||
9691 | { | ||
9692 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | ||
9693 | "Maybe too early, because message are sorted by next_attempt, if there are no fragments in flight.Checked message %llu\n", | ||
9694 | pos->logging_uuid); | ||
9695 | sc->to_early = GNUNET_YES; | ||
9696 | sc->to_early_retry_delay = GNUNET_TIME_absolute_get_remaining ( | ||
9697 | pos->next_attempt); | ||
9698 | continue; | ||
9699 | } | ||
9700 | // break; /* too early for all messages, they are sorted by next_attempt */ | ||
9679 | } | 9701 | } |
9680 | sc->to_early = GNUNET_NO; | ||
9681 | if (NULL != pos->qe) | 9702 | if (NULL != pos->qe) |
9682 | { | 9703 | { |
9683 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 9704 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
@@ -9741,7 +9762,7 @@ select_best_pending_from_link (struct PendingMessageScoreContext *sc, | |||
9741 | 9762 | ||
9742 | /* Finally, compare to existing 'best' in sc to see if this 'pos' pending | 9763 | /* Finally, compare to existing 'best' in sc to see if this 'pos' pending |
9743 | message would beat it! */ | 9764 | message would beat it! */ |
9744 | if (NULL != sc->best) | 9765 | if (GNUNET_NO == sc->frags_in_flight && NULL != sc->best) |
9745 | { | 9766 | { |
9746 | /* CHECK if pos fits queue BETTER (=smaller) than pm, if not: continue; | 9767 | /* CHECK if pos fits queue BETTER (=smaller) than pm, if not: continue; |
9747 | OPTIMIZE-ME: This is a heuristic, which so far has NOT been | 9768 | OPTIMIZE-ME: This is a heuristic, which so far has NOT been |