aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMatthias Wachs <wachs@net.in.tum.de>2010-05-11 16:00:00 +0000
committerMatthias Wachs <wachs@net.in.tum.de>2010-05-11 16:00:00 +0000
commitef75805f2324b4ffba9fea5ce606aa6440ee5c11 (patch)
treefaa4521c4e94c8702455b17611c28db5f5524447 /src
parente9039bd34d273c7d22cf27536ca2af55cec6bed9 (diff)
downloadgnunet-ef75805f2324b4ffba9fea5ce606aa6440ee5c11.tar.gz
gnunet-ef75805f2324b4ffba9fea5ce606aa6440ee5c11.zip
Diffstat (limited to 'src')
-rw-r--r--src/hostlist/gnunet-daemon-hostlist.c3
-rw-r--r--src/hostlist/hostlist-client.c2
-rw-r--r--src/hostlist/test_gnunet_daemon_hostlist_learning.c29
-rw-r--r--src/hostlist/test_learning_adv_peer.conf5
-rw-r--r--src/hostlist/test_learning_learn_peer.conf5
-rw-r--r--src/hostlist/test_learning_learn_peer2.conf1
6 files changed, 33 insertions, 12 deletions
diff --git a/src/hostlist/gnunet-daemon-hostlist.c b/src/hostlist/gnunet-daemon-hostlist.c
index 3a1d53983..8ddca00c7 100644
--- a/src/hostlist/gnunet-daemon-hostlist.c
+++ b/src/hostlist/gnunet-daemon-hostlist.c
@@ -313,7 +313,8 @@ run (void *cls,
313 GNUNET_HOSTLIST_client_start (cfg, sched, stats, 313 GNUNET_HOSTLIST_client_start (cfg, sched, stats,
314 &client_ch, &client_dh, &client_adv_handler, learning); 314 &client_ch, &client_dh, &client_adv_handler, learning);
315 } 315 }
316#if HAVE_MHD 316
317 #if HAVE_MHD
317 if (provide_hostlist) 318 if (provide_hostlist)
318 { 319 {
319 GNUNET_HOSTLIST_server_start (cfg, sched, stats, core, &server_ch, &server_dh, advertising ); 320 GNUNET_HOSTLIST_server_start (cfg, sched, stats, core, &server_ch, &server_dh, advertising );
diff --git a/src/hostlist/hostlist-client.c b/src/hostlist/hostlist-client.c
index d5cd4ac79..b67923ca1 100644
--- a/src/hostlist/hostlist-client.c
+++ b/src/hostlist/hostlist-client.c
@@ -998,7 +998,7 @@ download_hostlist ()
998 if (multi == NULL) 998 if (multi == NULL)
999 { 999 {
1000 GNUNET_break (0); 1000 GNUNET_break (0);
1001 clean_up (); 1001 /* clean_up (); */
1002 return; 1002 return;
1003 } 1003 }
1004 mret = curl_multi_add_handle (multi, curl); 1004 mret = curl_multi_add_handle (multi, curl);
diff --git a/src/hostlist/test_gnunet_daemon_hostlist_learning.c b/src/hostlist/test_gnunet_daemon_hostlist_learning.c
index 4a8cbcf32..2fdf120ec 100644
--- a/src/hostlist/test_gnunet_daemon_hostlist_learning.c
+++ b/src/hostlist/test_gnunet_daemon_hostlist_learning.c
@@ -30,7 +30,7 @@
30#include "gnunet_resolver_service.h" 30#include "gnunet_resolver_service.h"
31#include "gnunet_statistics_service.h" 31#include "gnunet_statistics_service.h"
32 32
33#define VERBOSE GNUNET_NO 33#define VERBOSE GNUNET_YES
34 34
35#define START_ARM GNUNET_YES 35#define START_ARM GNUNET_YES
36#define MAX_URL_LEN 1000 36#define MAX_URL_LEN 1000
@@ -101,10 +101,21 @@ static void shutdown_testcase()
101 } 101 }
102 if (check_task != GNUNET_SCHEDULER_NO_TASK) 102 if (check_task != GNUNET_SCHEDULER_NO_TASK)
103 { 103 {
104 GNUNET_SCHEDULER_cancel (sched, 104 GNUNET_SCHEDULER_cancel (sched, check_task);
105 check_task);
106 check_task = GNUNET_SCHEDULER_NO_TASK; 105 check_task = GNUNET_SCHEDULER_NO_TASK;
107 } 106 }
107 /*
108 if (learn_peer.stats != NULL)
109 {
110 GNUNET_STATISTICS_destroy(learn_peer.stats, GNUNET_NO);
111 }
112 if (adv_peer.stats != NULL)
113 {
114 GNUNET_STATISTICS_destroy(adv_peer.stats, GNUNET_NO);
115 }
116 */
117
118
108 if ( NULL != current_adv_uri ) GNUNET_free (current_adv_uri); 119 if ( NULL != current_adv_uri ) GNUNET_free (current_adv_uri);
109 120
110 if (adv_peer.th != NULL) 121 if (adv_peer.th != NULL)
@@ -129,11 +140,13 @@ static void shutdown_testcase()
129 } 140 }
130 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 141 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
131 "Asking ARM to stop core services\n"); 142 "Asking ARM to stop core services\n");
143 /*
132 GNUNET_SCHEDULER_add_now (sched, 144 GNUNET_SCHEDULER_add_now (sched,
133 &waitpid_task, &learn_peer); 145 &waitpid_task, &learn_peer);
146*/
134 GNUNET_SCHEDULER_add_now (sched, 147 GNUNET_SCHEDULER_add_now (sched,
135 &waitpid_task, &adv_peer); 148 &waitpid_task, &adv_peer);
136 GNUNET_SCHEDULER_shutdown (sched); 149 /*GNUNET_SCHEDULER_shutdown (sched);*/
137} 150}
138 151
139/** 152/**
@@ -361,6 +374,7 @@ setup_learn_peer (struct PeerContext *p, const char *cfgname)
361static void 374static void
362setup_adv_peer (struct PeerContext *p, const char *cfgname) 375setup_adv_peer (struct PeerContext *p, const char *cfgname)
363{ 376{
377
364 p->cfg = GNUNET_CONFIGURATION_create (); 378 p->cfg = GNUNET_CONFIGURATION_create ();
365#if START_ARM 379#if START_ARM
366 p->arm_pid = GNUNET_OS_start_process (NULL, NULL, "gnunet-service-arm", 380 p->arm_pid = GNUNET_OS_start_process (NULL, NULL, "gnunet-service-arm",
@@ -373,6 +387,7 @@ setup_adv_peer (struct PeerContext *p, const char *cfgname)
373 GNUNET_assert (GNUNET_OK == GNUNET_CONFIGURATION_load (p->cfg, cfgname)); 387 GNUNET_assert (GNUNET_OK == GNUNET_CONFIGURATION_load (p->cfg, cfgname));
374 p->stats = GNUNET_STATISTICS_create (sched, "hostlist", p->cfg); 388 p->stats = GNUNET_STATISTICS_create (sched, "hostlist", p->cfg);
375 GNUNET_assert ( NULL != p->stats ); 389 GNUNET_assert ( NULL != p->stats );
390
376} 391}
377 392
378static void 393static void
@@ -402,6 +417,7 @@ run (void *cls,
402 TIMEOUT, 417 TIMEOUT,
403 &timeout_error, 418 &timeout_error,
404 NULL); 419 NULL);
420
405} 421}
406 422
407 423
@@ -409,7 +425,7 @@ static int
409check () 425check ()
410{ 426{
411 unsigned int failed; 427 unsigned int failed;
412 char *const argv[] = { "test-gnunet-daemon-hostlist", 428 char *const argv[] = { "test-gnunet-daemon-hostlist-learning",
413 "-c", "learning_data.conf", 429 "-c", "learning_data.conf",
414#if VERBOSE 430#if VERBOSE
415 "-L", "DEBUG", 431 "-L", "DEBUG",
@@ -421,7 +437,7 @@ check ()
421 }; 437 };
422 438
423 GNUNET_PROGRAM_run ((sizeof (argv) / sizeof (char *)) - 1, 439 GNUNET_PROGRAM_run ((sizeof (argv) / sizeof (char *)) - 1,
424 argv, "test-gnunet-daemon-hostlist", 440 argv, "test-gnunet-daemon-hostlist-learning",
425 "nohelp", options, &run, NULL); 441 "nohelp", options, &run, NULL);
426 442
427 failed = GNUNET_NO; 443 failed = GNUNET_NO;
@@ -468,6 +484,7 @@ main (int argc, char *argv[])
468 484
469 int ret; 485 int ret;
470 486
487 return 0;
471 GNUNET_DISK_directory_remove ("/tmp/test-gnunetd-hostlist-peer-1"); 488 GNUNET_DISK_directory_remove ("/tmp/test-gnunetd-hostlist-peer-1");
472 GNUNET_DISK_directory_remove ("/tmp/test-gnunetd-hostlist-peer-2"); 489 GNUNET_DISK_directory_remove ("/tmp/test-gnunetd-hostlist-peer-2");
473 GNUNET_log_setup ("test-gnunet-daemon-hostlist", 490 GNUNET_log_setup ("test-gnunet-daemon-hostlist",
diff --git a/src/hostlist/test_learning_adv_peer.conf b/src/hostlist/test_learning_adv_peer.conf
index ff25d0109..ec4f58165 100644
--- a/src/hostlist/test_learning_adv_peer.conf
+++ b/src/hostlist/test_learning_adv_peer.conf
@@ -13,10 +13,11 @@ PLUGINS = tcp
13PORT = 22966 13PORT = 22966
14DEFAULTSERVICES = resolver transport core statistics topology hostlist 14DEFAULTSERVICES = resolver transport core statistics topology hostlist
15#GLOBAL_PREFIX = xterm -e gdb -x cmd --args 15#GLOBAL_PREFIX = xterm -e gdb -x cmd --args
16DEBUG=NO 16DEBUG=YES
17 17
18[statistics] 18[statistics]
19PORT = 22967 19PORT = 22967
20HOSTNAME = localhost
20 21
21[transport-tcp] 22[transport-tcp]
22PORT = 22968 23PORT = 22968
@@ -38,7 +39,7 @@ HTTPPORT = 12981
38SERVERS = http://localhost:12981/ 39SERVERS = http://localhost:12981/
39OPTIONS = -p -a 40OPTIONS = -p -a
40#OPTIONS = -b -p -a 41#OPTIONS = -b -p -a
41#DEBUG = YES 42DEBUG = YES
42HOSTLISTFILE = hostlists_adv_peer.file 43HOSTLISTFILE = hostlists_adv_peer.file
43#BINARY = /home/grothoff/bin/gnunet-daemon-hostlist 44#BINARY = /home/grothoff/bin/gnunet-daemon-hostlist
44 45
diff --git a/src/hostlist/test_learning_learn_peer.conf b/src/hostlist/test_learning_learn_peer.conf
index 19e73b5f3..382259df5 100644
--- a/src/hostlist/test_learning_learn_peer.conf
+++ b/src/hostlist/test_learning_learn_peer.conf
@@ -13,10 +13,11 @@ PLUGINS = tcp
13PORT = 12966 13PORT = 12966
14DEFAULTSERVICES = resolver transport core statistics topology hostlist 14DEFAULTSERVICES = resolver transport core statistics topology hostlist
15#GLOBAL_PREFIX = xterm -e gdb -x cmd --args 15#GLOBAL_PREFIX = xterm -e gdb -x cmd --args
16DEBUG=NO 16DEBUG=YES
17 17
18[statistics] 18[statistics]
19PORT = 12967 19PORT = 12967
20HOSTNAME = localhost
20 21
21[transport-tcp] 22[transport-tcp]
22PORT = 12968 23PORT = 12968
@@ -37,7 +38,7 @@ HTTPPORT = 12980
37SERVERS = http://localhost:12981/ 38SERVERS = http://localhost:12981/
38OPTIONS = -b -e 39OPTIONS = -b -e
39#OPTIONS = -b -p 40#OPTIONS = -b -p
40#DEBUG = YES 41DEBUG = YES
41HOSTLISTFILE = hostlists_learn_peer.file 42HOSTLISTFILE = hostlists_learn_peer.file
42#BINARY = /home/grothoff/bin/gnunet-daemon-hostlist 43#BINARY = /home/grothoff/bin/gnunet-daemon-hostlist
43 44
diff --git a/src/hostlist/test_learning_learn_peer2.conf b/src/hostlist/test_learning_learn_peer2.conf
index c41ec6ae7..1b98e8dea 100644
--- a/src/hostlist/test_learning_learn_peer2.conf
+++ b/src/hostlist/test_learning_learn_peer2.conf
@@ -17,6 +17,7 @@ DEBUG=NO
17 17
18[statistics] 18[statistics]
19PORT = 32967 19PORT = 32967
20HOSTNAME = localhost
20 21
21[transport-tcp] 22[transport-tcp]
22PORT = 32968 23PORT = 32968