diff options
author | Christian Grothoff <christian@grothoff.org> | 2011-07-23 14:37:37 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2011-07-23 14:37:37 +0000 |
commit | 49fb611b2c5c7e438318356a675d8da99e52d739 (patch) | |
tree | 752c5ea5de6647dc8ee7df0712e8aa876f12800b /src | |
parent | fdd29c5663f10fadca628793e72ef9d56a9d2fe6 (diff) | |
download | gnunet-49fb611b2c5c7e438318356a675d8da99e52d739.tar.gz gnunet-49fb611b2c5c7e438318356a675d8da99e52d739.zip |
fixes
Diffstat (limited to 'src')
-rw-r--r-- | src/arm/gnunet-arm.c | 2 | ||||
-rw-r--r-- | src/nse/gnunet-service-nse.c | 5 | ||||
-rw-r--r-- | src/nse/test_nse_multipeer.c | 62 |
3 files changed, 46 insertions, 23 deletions
diff --git a/src/arm/gnunet-arm.c b/src/arm/gnunet-arm.c index 65417647b..0029e8a62 100644 --- a/src/arm/gnunet-arm.c +++ b/src/arm/gnunet-arm.c | |||
@@ -39,7 +39,7 @@ | |||
39 | /** | 39 | /** |
40 | * Timeout for stopping ARM. Extra-long since ARM needs to stop everyone else. | 40 | * Timeout for stopping ARM. Extra-long since ARM needs to stop everyone else. |
41 | */ | 41 | */ |
42 | #define STOP_TIMEOUT_ARM GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 30) | 42 | #define STOP_TIMEOUT_ARM GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 3) |
43 | 43 | ||
44 | /** | 44 | /** |
45 | * Timeout for starting services, very short because of the strange way start works | 45 | * Timeout for starting services, very short because of the strange way start works |
diff --git a/src/nse/gnunet-service-nse.c b/src/nse/gnunet-service-nse.c index f11c6e5f4..cb0216dc6 100644 --- a/src/nse/gnunet-service-nse.c +++ b/src/nse/gnunet-service-nse.c | |||
@@ -870,6 +870,7 @@ handle_p2p_size_estimate(void *cls, | |||
870 | if (peer_entry->transmit_task != GNUNET_SCHEDULER_NO_TASK) | 870 | if (peer_entry->transmit_task != GNUNET_SCHEDULER_NO_TASK) |
871 | { | 871 | { |
872 | GNUNET_SCHEDULER_cancel (peer_entry->transmit_task); | 872 | GNUNET_SCHEDULER_cancel (peer_entry->transmit_task); |
873 | peer_entry->transmit_task = GNUNET_SCHEDULER_NO_TASK; | ||
873 | peer_entry->previous_round = GNUNET_NO; | 874 | peer_entry->previous_round = GNUNET_NO; |
874 | } | 875 | } |
875 | if (peer_entry->th != NULL) | 876 | if (peer_entry->th != NULL) |
@@ -1019,7 +1020,7 @@ shutdown_task(void *cls, | |||
1019 | * @param identity the public identity of this peer | 1020 | * @param identity the public identity of this peer |
1020 | * @param publicKey the public key of this peer | 1021 | * @param publicKey the public key of this peer |
1021 | */ | 1022 | */ |
1022 | void | 1023 | static void |
1023 | core_init (void *cls, struct GNUNET_CORE_Handle *server, | 1024 | core_init (void *cls, struct GNUNET_CORE_Handle *server, |
1024 | const struct GNUNET_PeerIdentity *identity, | 1025 | const struct GNUNET_PeerIdentity *identity, |
1025 | const struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded *publicKey) | 1026 | const struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded *publicKey) |
@@ -1046,7 +1047,7 @@ core_init (void *cls, struct GNUNET_CORE_Handle *server, | |||
1046 | 1047 | ||
1047 | for (i=0;i<HISTORY_SIZE;i++) | 1048 | for (i=0;i<HISTORY_SIZE;i++) |
1048 | { | 1049 | { |
1049 | prev_time.abs_value = next_timestamp.abs_value - (HISTORY_SIZE - i - 1) * GNUNET_NSE_INTERVAL.rel_value; | 1050 | prev_time.abs_value = current_timestamp.abs_value - (HISTORY_SIZE - i - 1) * GNUNET_NSE_INTERVAL.rel_value; |
1050 | setup_flood_message (i, prev_time); | 1051 | setup_flood_message (i, prev_time); |
1051 | } | 1052 | } |
1052 | estimate_index = HISTORY_SIZE - 1; | 1053 | estimate_index = HISTORY_SIZE - 1; |
diff --git a/src/nse/test_nse_multipeer.c b/src/nse/test_nse_multipeer.c index 2f538b62c..bfd7741b1 100644 --- a/src/nse/test_nse_multipeer.c +++ b/src/nse/test_nse_multipeer.c | |||
@@ -66,13 +66,15 @@ static struct GNUNET_TESTING_PeerGroup *pg; | |||
66 | /** | 66 | /** |
67 | * Check whether peers successfully shut down. | 67 | * Check whether peers successfully shut down. |
68 | */ | 68 | */ |
69 | void | 69 | static void |
70 | shutdown_callback (void *cls, const char *emsg) | 70 | shutdown_callback (void *cls, const char *emsg) |
71 | { | 71 | { |
72 | if (emsg != NULL) | 72 | if (emsg != NULL) |
73 | { | 73 | { |
74 | #if VERBOSE | 74 | #if VERBOSE |
75 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Shutdown of peers failed!\n"); | 75 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
76 | "Shutdown of peers failed: %s!\n", | ||
77 | emsg); | ||
76 | #endif | 78 | #endif |
77 | if (ok == 0) | 79 | if (ok == 0) |
78 | ok = 666; | 80 | ok = 666; |
@@ -119,9 +121,17 @@ static void | |||
119 | handle_estimate (void *cls, double estimate, double std_dev) | 121 | handle_estimate (void *cls, double estimate, double std_dev) |
120 | { | 122 | { |
121 | struct NSEPeer *peer = cls; | 123 | struct NSEPeer *peer = cls; |
122 | fprintf(stderr, "Received network size estimate from peer %s. Size: %f std.dev. %f\n", GNUNET_i2s(&peer->daemon->id), estimate, std_dev); | 124 | |
125 | fprintf (stderr, | ||
126 | "Received network size estimate from peer %s. logSize: %f std.dev. %f (%f/%u)\n", | ||
127 | GNUNET_i2s(&peer->daemon->id), | ||
128 | estimate, | ||
129 | std_dev, | ||
130 | GNUNET_NSE_log_estimate_to_n (estimate), | ||
131 | num_peers); | ||
123 | } | 132 | } |
124 | 133 | ||
134 | |||
125 | static void | 135 | static void |
126 | connect_nse_service (void *cls, | 136 | connect_nse_service (void *cls, |
127 | const struct GNUNET_SCHEDULER_TaskContext *tc) | 137 | const struct GNUNET_SCHEDULER_TaskContext *tc) |
@@ -135,13 +145,15 @@ connect_nse_service (void *cls, | |||
135 | { | 145 | { |
136 | current_peer = GNUNET_malloc(sizeof(struct NSEPeer)); | 146 | current_peer = GNUNET_malloc(sizeof(struct NSEPeer)); |
137 | current_peer->daemon = GNUNET_TESTING_daemon_get(pg, i); | 147 | current_peer->daemon = GNUNET_TESTING_daemon_get(pg, i); |
138 | current_peer->nse_handle = GNUNET_NSE_connect (current_peer->daemon->cfg, &handle_estimate, current_peer); | 148 | current_peer->nse_handle = GNUNET_NSE_connect (current_peer->daemon->cfg, |
149 | &handle_estimate, | ||
150 | current_peer); | ||
139 | GNUNET_assert(current_peer->nse_handle != NULL); | 151 | GNUNET_assert(current_peer->nse_handle != NULL); |
140 | |||
141 | GNUNET_CONTAINER_DLL_insert (peer_head, peer_tail, current_peer); | 152 | GNUNET_CONTAINER_DLL_insert (peer_head, peer_tail, current_peer); |
142 | } | 153 | } |
143 | } | 154 | } |
144 | 155 | ||
156 | |||
145 | static void | 157 | static void |
146 | my_cb (void *cls, | 158 | my_cb (void *cls, |
147 | const char *emsg) | 159 | const char *emsg) |
@@ -159,13 +171,15 @@ my_cb (void *cls, | |||
159 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 171 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
160 | "Peer Group started successfully, connecting to NSE service for each peer!\n"); | 172 | "Peer Group started successfully, connecting to NSE service for each peer!\n"); |
161 | #endif | 173 | #endif |
162 | GNUNET_log (GNUNET_ERROR_TYPE_WARNING, "Have %u connections\n", total_connections); | 174 | GNUNET_log (GNUNET_ERROR_TYPE_WARNING, |
175 | "Have %u connections\n", total_connections); | ||
163 | 176 | ||
164 | GNUNET_SCHEDULER_add_now(&connect_nse_service, NULL); | 177 | GNUNET_SCHEDULER_add_now(&connect_nse_service, NULL); |
165 | } | 178 | } |
166 | 179 | ||
180 | |||
167 | /** | 181 | /** |
168 | * Prototype of a function that will be called whenever | 182 | * Function that will be called whenever |
169 | * two daemons are connected by the testing library. | 183 | * two daemons are connected by the testing library. |
170 | * | 184 | * |
171 | * @param cls closure | 185 | * @param cls closure |
@@ -178,15 +192,16 @@ my_cb (void *cls, | |||
178 | * @param second_daemon handle for the second daemon | 192 | * @param second_daemon handle for the second daemon |
179 | * @param emsg error message (NULL on success) | 193 | * @param emsg error message (NULL on success) |
180 | */ | 194 | */ |
181 | void connect_cb (void *cls, | 195 | static void |
182 | const struct GNUNET_PeerIdentity *first, | 196 | connect_cb (void *cls, |
183 | const struct GNUNET_PeerIdentity *second, | 197 | const struct GNUNET_PeerIdentity *first, |
184 | uint32_t distance, | 198 | const struct GNUNET_PeerIdentity *second, |
185 | const struct GNUNET_CONFIGURATION_Handle *first_cfg, | 199 | uint32_t distance, |
186 | const struct GNUNET_CONFIGURATION_Handle *second_cfg, | 200 | const struct GNUNET_CONFIGURATION_Handle *first_cfg, |
187 | struct GNUNET_TESTING_Daemon *first_daemon, | 201 | const struct GNUNET_CONFIGURATION_Handle *second_cfg, |
188 | struct GNUNET_TESTING_Daemon *second_daemon, | 202 | struct GNUNET_TESTING_Daemon *first_daemon, |
189 | const char *emsg) | 203 | struct GNUNET_TESTING_Daemon *second_daemon, |
204 | const char *emsg) | ||
190 | { | 205 | { |
191 | char *second_id; | 206 | char *second_id; |
192 | 207 | ||
@@ -207,16 +222,22 @@ run (void *cls, | |||
207 | { | 222 | { |
208 | struct GNUNET_CONFIGURATION_Handle *testing_cfg; | 223 | struct GNUNET_CONFIGURATION_Handle *testing_cfg; |
209 | unsigned long long total_peers; | 224 | unsigned long long total_peers; |
225 | |||
210 | ok = 1; | 226 | ok = 1; |
211 | testing_cfg = GNUNET_CONFIGURATION_create(); | 227 | testing_cfg = GNUNET_CONFIGURATION_create(); |
212 | GNUNET_assert(GNUNET_OK == GNUNET_CONFIGURATION_load(testing_cfg, cfgfile)); | 228 | GNUNET_assert(GNUNET_OK == GNUNET_CONFIGURATION_load(testing_cfg, cfgfile)); |
229 | |||
213 | #if VERBOSE | 230 | #if VERBOSE |
214 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Starting daemons.\n"); | 231 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Starting daemons.\n"); |
215 | GNUNET_CONFIGURATION_set_value_string (testing_cfg, "testing", | 232 | GNUNET_CONFIGURATION_set_value_string (testing_cfg, |
216 | "use_progressbars", | 233 | "testing", |
217 | "YES"); | 234 | "use_progressbars", |
235 | "YES"); | ||
218 | #endif | 236 | #endif |
219 | if (GNUNET_OK != GNUNET_CONFIGURATION_get_value_number (testing_cfg, "testing", "num_peers", &total_peers)) | 237 | if (GNUNET_OK != GNUNET_CONFIGURATION_get_value_number (testing_cfg, |
238 | "testing", | ||
239 | "num_peers", | ||
240 | &total_peers)) | ||
220 | total_peers = NUM_PEERS; | 241 | total_peers = NUM_PEERS; |
221 | 242 | ||
222 | peers_left = total_peers; | 243 | peers_left = total_peers; |
@@ -231,6 +252,7 @@ run (void *cls, | |||
231 | GNUNET_SCHEDULER_add_delayed (TIMEOUT, &shutdown_task, NULL); | 252 | GNUNET_SCHEDULER_add_delayed (TIMEOUT, &shutdown_task, NULL); |
232 | } | 253 | } |
233 | 254 | ||
255 | |||
234 | static int | 256 | static int |
235 | check () | 257 | check () |
236 | { | 258 | { |