diff options
author | Matthias Wachs <wachs@net.in.tum.de> | 2013-10-29 16:41:20 +0000 |
---|---|---|
committer | Matthias Wachs <wachs@net.in.tum.de> | 2013-10-29 16:41:20 +0000 |
commit | ba535e484705db8b67714c156bfb5585779e3a0b (patch) | |
tree | e54f923c672fed8ceca4f2dd5a6e281d1289b1aa /src/ats/perf_ats_solver.c | |
parent | 4f261de996daf0c2100eeb19cf3201f8e76930fc (diff) | |
download | gnunet-ba535e484705db8b67714c156bfb5585779e3a0b.tar.gz gnunet-ba535e484705db8b67714c156bfb5585779e3a0b.zip |
fix peer creation
Diffstat (limited to 'src/ats/perf_ats_solver.c')
-rw-r--r-- | src/ats/perf_ats_solver.c | 37 |
1 files changed, 31 insertions, 6 deletions
diff --git a/src/ats/perf_ats_solver.c b/src/ats/perf_ats_solver.c index f93c0b333..6f275b0cc 100644 --- a/src/ats/perf_ats_solver.c +++ b/src/ats/perf_ats_solver.c | |||
@@ -153,9 +153,9 @@ end_now (int res) | |||
153 | static void | 153 | static void |
154 | perf_create_peer (int cp) | 154 | perf_create_peer (int cp) |
155 | { | 155 | { |
156 | /* | 156 | |
157 | GNUNET_CRYPTO_hash_create_random (GNUNET_CRYPTO_QUALITY_WEAK, | 157 | GNUNET_CRYPTO_random_block (GNUNET_CRYPTO_QUALITY_WEAK, |
158 | &ph.peers[cp].id.);*/ | 158 | &ph.peers[cp].id, sizeof (struct GNUNET_PeerIdentity)); |
159 | GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, "Creating peer #%u: %s \n", cp, | 159 | GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, "Creating peer #%u: %s \n", cp, |
160 | GNUNET_i2s (&ph.peers[cp].id)); | 160 | GNUNET_i2s (&ph.peers[cp].id)); |
161 | } | 161 | } |
@@ -302,12 +302,17 @@ check () | |||
302 | int ca; | 302 | int ca; |
303 | int count_p = ph.N_peers_end; | 303 | int count_p = ph.N_peers_end; |
304 | int count_a = ph.N_address; | 304 | int count_a = ph.N_address; |
305 | int bulk_running; | ||
305 | struct ATS_Address * cur_addr; | 306 | struct ATS_Address * cur_addr; |
306 | ph.peers = GNUNET_malloc ((count_p) * sizeof (struct PerfPeer)); | 307 | ph.peers = GNUNET_malloc ((count_p) * sizeof (struct PerfPeer)); |
307 | 308 | ||
308 | for (cp = 0; cp < count_p; cp++) | 309 | for (cp = 0; cp < count_p; cp++) |
309 | perf_create_peer (cp); | 310 | perf_create_peer (cp); |
310 | 311 | ||
312 | /* Set initial bulk start to not solve */ | ||
313 | ph.env.sf.s_bulk_start (ph.solver); | ||
314 | bulk_running = GNUNET_YES; | ||
315 | |||
311 | for (cp = 0; cp < count_p; cp++) | 316 | for (cp = 0; cp < count_p; cp++) |
312 | { | 317 | { |
313 | for (ca = 0; ca < count_a; ca++) | 318 | for (ca = 0; ca < count_a; ca++) |
@@ -316,13 +321,30 @@ check () | |||
316 | /* add address */ | 321 | /* add address */ |
317 | ph.env.sf.s_add (ph.solver, cur_addr, GNUNET_ATS_NET_LAN); | 322 | ph.env.sf.s_add (ph.solver, cur_addr, GNUNET_ATS_NET_LAN); |
318 | address_initial_update (ph.solver, ph.addresses, cur_addr); | 323 | address_initial_update (ph.solver, ph.addresses, cur_addr); |
319 | GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, | 324 | GNUNET_log(GNUNET_ERROR_TYPE_INFO, |
320 | "Adding address for peer %u address %u\n", cp, ca); | 325 | "Adding address for peer %u address %u\n", cp, ca); |
321 | } | 326 | } |
322 | //ph.env.sf.s_get (ph.solver, &ph.peers[cp].id); | 327 | ph.env.sf.s_get (ph.solver, &ph.peers[cp].id); |
328 | |||
323 | if (cp + 1 >= ph.N_peers_start) | 329 | if (cp + 1 >= ph.N_peers_start) |
324 | { | 330 | { |
325 | /* Solve */ | 331 | /* Disable bulk to solve the problem */ |
332 | if (GNUNET_YES == bulk_running) | ||
333 | { | ||
334 | ph.env.sf.s_bulk_stop (ph.solver); | ||
335 | bulk_running = GNUNET_NO; | ||
336 | } | ||
337 | |||
338 | /* Problem should be solved here */ | ||
339 | |||
340 | /* Disable bulk to solve the problem */ | ||
341 | if (GNUNET_NO == bulk_running) | ||
342 | { | ||
343 | ph.env.sf.s_bulk_start (ph.solver); | ||
344 | bulk_running = GNUNET_YES; | ||
345 | } | ||
346 | |||
347 | #if 0 | ||
326 | if ((0 < ph.opt_update_quantity) || (0 < ph.opt_update_percent)) | 348 | if ((0 < ph.opt_update_quantity) || (0 < ph.opt_update_percent)) |
327 | { | 349 | { |
328 | /* Update */ | 350 | /* Update */ |
@@ -332,8 +354,11 @@ check () | |||
332 | //update_addresses (cp + 1, ca, ph.opt_update_quantity); | 354 | //update_addresses (cp + 1, ca, ph.opt_update_quantity); |
333 | //ph.env.sf.s_bulk_stop (ph.solver); | 355 | //ph.env.sf.s_bulk_stop (ph.solver); |
334 | } | 356 | } |
357 | #endif | ||
335 | } | 358 | } |
336 | } | 359 | } |
360 | GNUNET_log(GNUNET_ERROR_TYPE_INFO, | ||
361 | "Done, cleaning up addresses\n"); | ||
337 | for (cp = 0; cp < count_p; cp++) | 362 | for (cp = 0; cp < count_p; cp++) |
338 | { | 363 | { |
339 | for (cur = ph.peers[cp].head; cur != NULL ; cur = next) | 364 | for (cur = ph.peers[cp].head; cur != NULL ; cur = next) |