aboutsummaryrefslogtreecommitdiff
path: root/src/nse
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2011-12-08 12:38:28 +0000
committerChristian Grothoff <christian@grothoff.org>2011-12-08 12:38:28 +0000
commitd42b8f058dc23bb5e309677d14321be026bf01c4 (patch)
tree482727fd31034ce154fa1af7445c827ba39f7159 /src/nse
parentbeb2ecada9d01b25b17f92c9d4cf7468f29a68e3 (diff)
downloadgnunet-d42b8f058dc23bb5e309677d14321be026bf01c4.tar.gz
gnunet-d42b8f058dc23bb5e309677d14321be026bf01c4.zip
fixing issue with sending back size estimate messages to peers that already have good estimate information
Diffstat (limited to 'src/nse')
-rw-r--r--src/nse/gnunet-service-nse.c27
1 files changed, 22 insertions, 5 deletions
diff --git a/src/nse/gnunet-service-nse.c b/src/nse/gnunet-service-nse.c
index d72670cb5..1910a3aa7 100644
--- a/src/nse/gnunet-service-nse.c
+++ b/src/nse/gnunet-service-nse.c
@@ -105,11 +105,6 @@ struct NSEPeerEntry
105{ 105{
106 106
107 /** 107 /**
108 * Pending message for this peer.
109 */
110 struct GNUNET_MessageHeader *pending_message;
111
112 /**
113 * Core handle for sending messages to this peer. 108 * Core handle for sending messages to this peer.
114 */ 109 */
115 struct GNUNET_CORE_TransmitHandle *th; 110 struct GNUNET_CORE_TransmitHandle *th;
@@ -1077,7 +1072,29 @@ handle_p2p_size_estimate (void *cls, const struct GNUNET_PeerIdentity *peer,
1077 } 1072 }
1078 } 1073 }
1079 if (matching_bits == ntohl (size_estimate_messages[idx].matching_bits)) 1074 if (matching_bits == ntohl (size_estimate_messages[idx].matching_bits))
1075 {
1076 /* cancel transmission in the other direction, as this peer clearly has
1077 up-to-date information already */
1078 if (idx != estimate_index)
1079 {
1080 /* do not transmit information for the previous round to this peer
1081 anymore (but allow current round) */
1082 peer_entry->previous_round = GNUNET_YES;
1083 return GNUNET_OK;
1084 }
1085 /* got up-to-date information for current round, cancel transmission altogether */
1086 if (GNUNET_SCHEDULER_NO_TASK != peer_entry->transmit_task)
1087 {
1088 GNUNET_SCHEDULER_cancel (peer_entry->transmit_task);
1089 peer_entry->transmit_task = GNUNET_SCHEDULER_NO_TASK;
1090 }
1091 if (peer_entry->th != NULL)
1092 {
1093 GNUNET_CORE_notify_transmit_ready_cancel (peer_entry->th);
1094 peer_entry->th = NULL;
1095 }
1080 return GNUNET_OK; 1096 return GNUNET_OK;
1097 }
1081 if (matching_bits <= ntohl (size_estimate_messages[idx].matching_bits)) 1098 if (matching_bits <= ntohl (size_estimate_messages[idx].matching_bits))
1082 { 1099 {
1083 if ((idx < estimate_index) && (peer_entry->previous_round == GNUNET_YES)) 1100 if ((idx < estimate_index) && (peer_entry->previous_round == GNUNET_YES))