diff options
author | Nathan S. Evans <evans@in.tum.de> | 2011-07-27 12:41:00 +0000 |
---|---|---|
committer | Nathan S. Evans <evans@in.tum.de> | 2011-07-27 12:41:00 +0000 |
commit | 2692cd41f52623b3599bbf9c8b5aa8572f7b90e8 (patch) | |
tree | e240b2a839c5c6ebd6ab2e4bdfcc2a046e6dbc03 /src/nse | |
parent | 64653fc0a7a092c8edff5c7c5bb770f0ae4bca61 (diff) | |
download | gnunet-2692cd41f52623b3599bbf9c8b5aa8572f7b90e8.tar.gz gnunet-2692cd41f52623b3599bbf9c8b5aa8572f7b90e8.zip |
redo send on connect
Diffstat (limited to 'src/nse')
-rw-r--r-- | src/nse/gnunet-service-nse.c | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/src/nse/gnunet-service-nse.c b/src/nse/gnunet-service-nse.c index 333c83776..a926c1f23 100644 --- a/src/nse/gnunet-service-nse.c +++ b/src/nse/gnunet-service-nse.c | |||
@@ -46,6 +46,11 @@ | |||
46 | #include "nse.h" | 46 | #include "nse.h" |
47 | 47 | ||
48 | /** | 48 | /** |
49 | * Send messages on connect. | ||
50 | */ | ||
51 | #define SEND_ON_CONNECT GNUNET_YES | ||
52 | |||
53 | /** | ||
49 | * Should we generate a histogram with the time stamps of when we received | 54 | * Should we generate a histogram with the time stamps of when we received |
50 | * NSE messages to disk? (for performance evaluation only, not useful in | 55 | * NSE messages to disk? (for performance evaluation only, not useful in |
51 | * production) | 56 | * production) |
@@ -303,9 +308,10 @@ setup_estimate_message (struct GNUNET_NSE_ClientMessage *em) | |||
303 | mean = 0.0; | 308 | mean = 0.0; |
304 | sum = 0.0; | 309 | sum = 0.0; |
305 | sumweight = 0.0; | 310 | sumweight = 0.0; |
306 | for (i=0;i<estimate_count; i++) | 311 | for (i = 0; i < estimate_count; i++) |
307 | { | 312 | { |
308 | val = htonl (size_estimate_messages[(estimate_index - i + HISTORY_SIZE) % HISTORY_SIZE].matching_bits); | 313 | val = htonl (size_estimate_messages[(estimate_index - i + HISTORY_SIZE) |
314 | % HISTORY_SIZE].matching_bits); | ||
309 | weight = estimate_count + 1 - i; | 315 | weight = estimate_count + 1 - i; |
310 | 316 | ||
311 | temp = weight + sumweight; | 317 | temp = weight + sumweight; |
@@ -701,7 +707,7 @@ update_flood_message(void *cls, | |||
701 | setup_flood_message (estimate_index, current_timestamp); | 707 | setup_flood_message (estimate_index, current_timestamp); |
702 | next_message.matching_bits = htonl (0); /* reset for 'next' round */ | 708 | next_message.matching_bits = htonl (0); /* reset for 'next' round */ |
703 | hop_count_max = 0; | 709 | hop_count_max = 0; |
704 | for (i=0;i<HISTORY_SIZE;i++) | 710 | for (i = 0; i < HISTORY_SIZE; i++) |
705 | hop_count_max = GNUNET_MAX (ntohl (size_estimate_messages[i].hop_count), | 711 | hop_count_max = GNUNET_MAX (ntohl (size_estimate_messages[i].hop_count), |
706 | hop_count_max); | 712 | hop_count_max); |
707 | GNUNET_CONTAINER_multihashmap_iterate (peers, | 713 | GNUNET_CONTAINER_multihashmap_iterate (peers, |
@@ -996,7 +1002,9 @@ handle_p2p_size_estimate(void *cls, | |||
996 | GNUNET_break (0); | 1002 | GNUNET_break (0); |
997 | return GNUNET_OK; | 1003 | return GNUNET_OK; |
998 | } | 1004 | } |
1005 | |||
999 | ts = GNUNET_TIME_absolute_ntoh (incoming_flood->timestamp); | 1006 | ts = GNUNET_TIME_absolute_ntoh (incoming_flood->timestamp); |
1007 | |||
1000 | if (ts.abs_value == current_timestamp.abs_value) | 1008 | if (ts.abs_value == current_timestamp.abs_value) |
1001 | idx = estimate_index; | 1009 | idx = estimate_index; |
1002 | else if (ts.abs_value == current_timestamp.abs_value - gnunet_nse_interval.rel_value) | 1010 | else if (ts.abs_value == current_timestamp.abs_value - gnunet_nse_interval.rel_value) |
@@ -1243,7 +1251,7 @@ core_init (void *cls, struct GNUNET_CORE_Handle *server, | |||
1243 | current_timestamp.abs_value = (now.abs_value / gnunet_nse_interval.rel_value) * gnunet_nse_interval.rel_value; | 1251 | current_timestamp.abs_value = (now.abs_value / gnunet_nse_interval.rel_value) * gnunet_nse_interval.rel_value; |
1244 | next_timestamp.abs_value = current_timestamp.abs_value + gnunet_nse_interval.rel_value; | 1252 | next_timestamp.abs_value = current_timestamp.abs_value + gnunet_nse_interval.rel_value; |
1245 | 1253 | ||
1246 | for (i=0;i<HISTORY_SIZE;i++) | 1254 | for (i = 0; i < HISTORY_SIZE; i++) |
1247 | { | 1255 | { |
1248 | prev_time.abs_value = current_timestamp.abs_value - (HISTORY_SIZE - i - 1) * gnunet_nse_interval.rel_value; | 1256 | prev_time.abs_value = current_timestamp.abs_value - (HISTORY_SIZE - i - 1) * gnunet_nse_interval.rel_value; |
1249 | setup_flood_message (i, prev_time); | 1257 | setup_flood_message (i, prev_time); |