push back
[oweals/gnunet.git] / src / nse / gnunet-service-nse.c
index 04ddf504116c9798402b6f32ffb8e8293fcf8dab..3d980ca26ae04eed46f6671d496b9c8a54c1ea1c 100644 (file)
@@ -312,7 +312,7 @@ setup_estimate_message (struct GNUNET_NSE_ClientMessage *em)
     {
       val = htonl (size_estimate_messages[(estimate_index - i + HISTORY_SIZE)
           % HISTORY_SIZE].matching_bits);
-      weight = estimate_count + 1 - i;
+      weight = 1; /* was: estimate_count + 1 - i; */
 
       temp = weight + sumweight;
       q = val - mean;
@@ -1068,6 +1068,14 @@ handle_p2p_size_estimate(void *cls,
     }
   if (matching_bits <= ntohl (size_estimate_messages[idx].matching_bits)) 
     {
+      if ( (idx < estimate_index) &&
+          (peer_entry->previous_round == GNUNET_YES) )
+       peer_entry->previous_round = GNUNET_NO;
+      /* push back our result now, that peer is spreading bad information... */
+      if (peer_entry->transmit_task != GNUNET_SCHEDULER_NO_TASK)
+       GNUNET_SCHEDULER_cancel (peer_entry->transmit_task);
+      peer_entry->transmit_task = GNUNET_SCHEDULER_add_now (&transmit_task,
+                                                           peer_entry);          
       /* Not closer than our most recent message, no need to do work here */
       GNUNET_STATISTICS_update (stats,
                                 "# flood messages ignored (had closer already)",