aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorBart Polot <bart@net.in.tum.de>2015-07-20 16:41:48 +0000
committerBart Polot <bart@net.in.tum.de>2015-07-20 16:41:48 +0000
commit48ffc3b9f756016e2eb01a183d72d1849dba6222 (patch)
tree3e3ffbad8de14a267a692db442b60eadf279412d /src
parentd1488c2a63088547f70a725761871ff0e41a0fb3 (diff)
downloadgnunet-48ffc3b9f756016e2eb01a183d72d1849dba6222.tar.gz
gnunet-48ffc3b9f756016e2eb01a183d72d1849dba6222.zip
- cancel retry task if all pending messages are freed by bitfield ACK
Diffstat (limited to 'src')
-rw-r--r--src/cadet/gnunet-service-cadet_channel.c14
1 files changed, 10 insertions, 4 deletions
diff --git a/src/cadet/gnunet-service-cadet_channel.c b/src/cadet/gnunet-service-cadet_channel.c
index 0b6a11599..234785732 100644
--- a/src/cadet/gnunet-service-cadet_channel.c
+++ b/src/cadet/gnunet-service-cadet_channel.c
@@ -1022,8 +1022,10 @@ channel_rel_free_all (struct CadetChannelReliability *rel)
1022 * 1022 *
1023 * @param rel Reliability data. 1023 * @param rel Reliability data.
1024 * @param msg DataACK message with a bitfield of future ACK'd messages. 1024 * @param msg DataACK message with a bitfield of future ACK'd messages.
1025 *
1026 * @return How many messages have been freed.
1025 */ 1027 */
1026static void 1028static unsigned int
1027channel_rel_free_sent (struct CadetChannelReliability *rel, 1029channel_rel_free_sent (struct CadetChannelReliability *rel,
1028 const struct GNUNET_CADET_DataACK *msg) 1030 const struct GNUNET_CADET_DataACK *msg)
1029{ 1031{
@@ -1034,12 +1036,13 @@ channel_rel_free_sent (struct CadetChannelReliability *rel,
1034 uint32_t mid; 1036 uint32_t mid;
1035 uint32_t target; 1037 uint32_t target;
1036 unsigned int i; 1038 unsigned int i;
1039 unsigned int r;
1037 1040
1038 bitfield = msg->futures; 1041 bitfield = msg->futures;
1039 mid = ntohl (msg->mid); 1042 mid = ntohl (msg->mid);
1040 LOG (GNUNET_ERROR_TYPE_DEBUG, "free_sent_reliable %u %llX\n", mid, bitfield); 1043 LOG (GNUNET_ERROR_TYPE_DEBUG, "free_sent_reliable %u %llX\n", mid, bitfield);
1041 LOG (GNUNET_ERROR_TYPE_DEBUG, " rel %p, head %p\n", rel, rel->head_sent); 1044 LOG (GNUNET_ERROR_TYPE_DEBUG, " rel %p, head %p\n", rel, rel->head_sent);
1042 for (i = 0, copy = rel->head_sent; 1045 for (i = 0, r = 0, copy = rel->head_sent;
1043 i < 64 && NULL != copy && 0 != bitfield; 1046 i < 64 && NULL != copy && 0 != bitfield;
1044 i++) 1047 i++)
1045 { 1048 {
@@ -1063,7 +1066,7 @@ channel_rel_free_sent (struct CadetChannelReliability *rel,
1063 if (NULL == copy) 1066 if (NULL == copy)
1064 { 1067 {
1065 LOG (GNUNET_ERROR_TYPE_DEBUG, "run out of copies...\n"); 1068 LOG (GNUNET_ERROR_TYPE_DEBUG, "run out of copies...\n");
1066 return; 1069 return r;
1067 } 1070 }
1068 1071
1069 /* Did we overshoot the target? (previously freed, it's ok) */ 1072 /* Did we overshoot the target? (previously freed, it's ok) */
@@ -1079,9 +1082,11 @@ channel_rel_free_sent (struct CadetChannelReliability *rel,
1079 /* Now copy->mid == target, free it */ 1082 /* Now copy->mid == target, free it */
1080 next = copy->next; 1083 next = copy->next;
1081 GNUNET_break (GNUNET_YES != rel_message_free (copy, GNUNET_YES)); 1084 GNUNET_break (GNUNET_YES != rel_message_free (copy, GNUNET_YES));
1085 r++;
1082 copy = next; 1086 copy = next;
1083 } 1087 }
1084 LOG (GNUNET_ERROR_TYPE_DEBUG, "free_sent_reliable END\n"); 1088 LOG (GNUNET_ERROR_TYPE_DEBUG, "free_sent_reliable END\n");
1089 return r;
1085} 1090}
1086 1091
1087 1092
@@ -2071,7 +2076,8 @@ GCCH_handle_data_ack (struct CadetChannel *ch,
2071 if (GC_is_pid_bigger (copy->mid, ack)) 2076 if (GC_is_pid_bigger (copy->mid, ack))
2072 { 2077 {
2073 LOG (GNUNET_ERROR_TYPE_DEBUG, " head %u, out!\n", copy->mid); 2078 LOG (GNUNET_ERROR_TYPE_DEBUG, " head %u, out!\n", copy->mid);
2074 channel_rel_free_sent (rel, msg); 2079 if (0 < channel_rel_free_sent (rel, msg))
2080 work = GNUNET_YES;
2075 break; 2081 break;
2076 } 2082 }
2077 work = GNUNET_YES; 2083 work = GNUNET_YES;