aboutsummaryrefslogtreecommitdiff
path: root/src/dht
diff options
context:
space:
mode:
Diffstat (limited to 'src/dht')
-rw-r--r--src/dht/gnunet-dht-get.c30
-rw-r--r--src/dht/gnunet-dht-monitor.c36
-rw-r--r--src/dht/gnunet-dht-put.c7
-rw-r--r--src/dht/gnunet-service-dht.c5
-rw-r--r--src/dht/gnunet-service-dht_clients.c4
-rw-r--r--src/dht/gnunet-service-dht_neighbours.c5
-rw-r--r--src/dht/gnunet-service-wdht.c5
-rw-r--r--src/dht/gnunet-service-wdht_clients.c4
-rw-r--r--src/dht/gnunet-service-xdht.c7
-rw-r--r--src/dht/gnunet-service-xdht_clients.c4
-rw-r--r--src/dht/gnunet_dht_profiler.c99
11 files changed, 117 insertions, 89 deletions
diff --git a/src/dht/gnunet-dht-get.c b/src/dht/gnunet-dht-get.c
index 6846b3af7..8a1b836f6 100644
--- a/src/dht/gnunet-dht-get.c
+++ b/src/dht/gnunet-dht-get.c
@@ -82,9 +82,14 @@ static unsigned int result_count;
82 */ 82 */
83static int ret; 83static int ret;
84 84
85/**
86 * Task scheduled to handle timeout.
87 */
88static struct GNUNET_SCHEDULER_Task *tt;
89
85 90
86/** 91/**
87 * Task run to clean up on timeout. 92 * Task run to clean up on shutdown.
88 * 93 *
89 * @param cls unused 94 * @param cls unused
90 */ 95 */
@@ -101,6 +106,24 @@ cleanup_task (void *cls)
101 GNUNET_DHT_disconnect (dht_handle); 106 GNUNET_DHT_disconnect (dht_handle);
102 dht_handle = NULL; 107 dht_handle = NULL;
103 } 108 }
109 if (NULL != tt)
110 {
111 GNUNET_SCHEDULER_cancel (tt);
112 tt = NULL;
113 }
114}
115
116
117/**
118 * Task run on timeout. Triggers shutdown.
119 *
120 * @param cls unused
121 */
122static void
123timeout_task (void *cls)
124{
125 tt = NULL;
126 GNUNET_SCHEDULER_shutdown ();
104} 127}
105 128
106 129
@@ -170,8 +193,9 @@ run (void *cls, char *const *args, const char *cfgfile,
170 GNUNET_CRYPTO_hash (query_key, strlen (query_key), &key); 193 GNUNET_CRYPTO_hash (query_key, strlen (query_key), &key);
171 if (verbose) 194 if (verbose)
172 FPRINTF (stderr, "%s `%s' \n", _("Issueing DHT GET with key"), GNUNET_h2s_full (&key)); 195 FPRINTF (stderr, "%s `%s' \n", _("Issueing DHT GET with key"), GNUNET_h2s_full (&key));
173 GNUNET_SCHEDULER_add_delayed (timeout_request, 196 GNUNET_SCHEDULER_add_shutdown (&cleanup_task, NULL);
174 &cleanup_task, NULL); 197 tt = GNUNET_SCHEDULER_add_delayed (timeout_request,
198 &timeout_task, NULL);
175 get_handle = 199 get_handle =
176 GNUNET_DHT_get_start (dht_handle, query_type, &key, replication, 200 GNUNET_DHT_get_start (dht_handle, query_type, &key, replication,
177 (demultixplex_everywhere) ? GNUNET_DHT_RO_DEMULTIPLEX_EVERYWHERE : GNUNET_DHT_RO_NONE, 201 (demultixplex_everywhere) ? GNUNET_DHT_RO_DEMULTIPLEX_EVERYWHERE : GNUNET_DHT_RO_NONE,
diff --git a/src/dht/gnunet-dht-monitor.c b/src/dht/gnunet-dht-monitor.c
index 0502496d7..7f14255d3 100644
--- a/src/dht/gnunet-dht-monitor.c
+++ b/src/dht/gnunet-dht-monitor.c
@@ -71,6 +71,11 @@ static unsigned int result_count;
71 */ 71 */
72static int ret; 72static int ret;
73 73
74/**
75 * Task scheduled to handle timeout.
76 */
77static struct GNUNET_SCHEDULER_Task *tt;
78
74 79
75/** 80/**
76 * Stop monitoring request and start shutdown 81 * Stop monitoring request and start shutdown
@@ -92,9 +97,28 @@ cleanup_task (void *cls)
92 GNUNET_DHT_disconnect (dht_handle); 97 GNUNET_DHT_disconnect (dht_handle);
93 dht_handle = NULL; 98 dht_handle = NULL;
94 } 99 }
100 if (NULL != tt)
101 {
102 GNUNET_SCHEDULER_cancel (tt);
103 tt = NULL;
104 }
105}
106
107
108/**
109 * We hit a timeout. Stop monitoring request and start shutdown
110 *
111 * @param cls closure (unused)
112 */
113static void
114timeout_task (void *cls)
115{
116 tt = NULL;
117 GNUNET_SCHEDULER_shutdown ();
95} 118}
96 119
97 120
121
98/** 122/**
99 * Callback called on each GET request going through the DHT. 123 * Callback called on each GET request going through the DHT.
100 * 124 *
@@ -107,7 +131,7 @@ cleanup_task (void *cls)
107 * @param desired_replication_level Desired replication level. 131 * @param desired_replication_level Desired replication level.
108 * @param key Key of the requested data. 132 * @param key Key of the requested data.
109 */ 133 */
110void 134static void
111get_callback (void *cls, 135get_callback (void *cls,
112 enum GNUNET_DHT_RouteOption options, 136 enum GNUNET_DHT_RouteOption options,
113 enum GNUNET_BLOCK_Type type, 137 enum GNUNET_BLOCK_Type type,
@@ -139,7 +163,7 @@ get_callback (void *cls,
139 * @param data Pointer to the result data. 163 * @param data Pointer to the result data.
140 * @param size Number of bytes in data. 164 * @param size Number of bytes in data.
141 */ 165 */
142void 166static void
143get_resp_callback (void *cls, 167get_resp_callback (void *cls,
144 enum GNUNET_BLOCK_Type type, 168 enum GNUNET_BLOCK_Type type,
145 const struct GNUNET_PeerIdentity *get_path, 169 const struct GNUNET_PeerIdentity *get_path,
@@ -177,7 +201,7 @@ get_resp_callback (void *cls,
177 * @param data Pointer to the data carried. 201 * @param data Pointer to the data carried.
178 * @param size Number of bytes in data. 202 * @param size Number of bytes in data.
179 */ 203 */
180void 204static void
181put_callback (void *cls, 205put_callback (void *cls,
182 enum GNUNET_DHT_RouteOption options, 206 enum GNUNET_DHT_RouteOption options,
183 enum GNUNET_BLOCK_Type type, 207 enum GNUNET_BLOCK_Type type,
@@ -242,7 +266,11 @@ run (void *cls, char *const *args, const char *cfgfile,
242 FPRINTF (stderr, 266 FPRINTF (stderr,
243 "Monitoring for %s\n", 267 "Monitoring for %s\n",
244 GNUNET_STRINGS_relative_time_to_string (timeout_request, GNUNET_NO)); 268 GNUNET_STRINGS_relative_time_to_string (timeout_request, GNUNET_NO));
245 GNUNET_SCHEDULER_add_delayed (timeout_request, &cleanup_task, NULL); 269 tt = GNUNET_SCHEDULER_add_delayed (timeout_request,
270 &timeout_task,
271 NULL);
272 GNUNET_SCHEDULER_add_shutdown (&cleanup_task,
273 NULL);
246 monitor_handle = GNUNET_DHT_monitor_start (dht_handle, 274 monitor_handle = GNUNET_DHT_monitor_start (dht_handle,
247 block_type, 275 block_type,
248 key, 276 key,
diff --git a/src/dht/gnunet-dht-put.c b/src/dht/gnunet-dht-put.c
index 19e385be1..972369e10 100644
--- a/src/dht/gnunet-dht-put.c
+++ b/src/dht/gnunet-dht-put.c
@@ -98,6 +98,7 @@ shutdown_task (void *cls)
98 } 98 }
99} 99}
100 100
101
101/** 102/**
102 * Signature of the main function of a task. 103 * Signature of the main function of a task.
103 * 104 *
@@ -132,6 +133,7 @@ message_sent_cont (void *cls, int success)
132 GNUNET_SCHEDULER_add_now (&shutdown_task, NULL); 133 GNUNET_SCHEDULER_add_now (&shutdown_task, NULL);
133} 134}
134 135
136
135/** 137/**
136 * Main function that will be run by the scheduler. 138 * Main function that will be run by the scheduler.
137 * 139 *
@@ -141,14 +143,15 @@ message_sent_cont (void *cls, int success)
141 * @param c configuration 143 * @param c configuration
142 */ 144 */
143static void 145static void
144run (void *cls, char *const *args, const char *cfgfile, 146run (void *cls,
147 char *const *args,
148 const char *cfgfile,
145 const struct GNUNET_CONFIGURATION_Handle *c) 149 const struct GNUNET_CONFIGURATION_Handle *c)
146{ 150{
147 struct GNUNET_TIME_Relative timeout; 151 struct GNUNET_TIME_Relative timeout;
148 struct GNUNET_TIME_Absolute expiration; 152 struct GNUNET_TIME_Absolute expiration;
149 153
150 cfg = c; 154 cfg = c;
151
152 if ((NULL == query_key) || (NULL == data)) 155 if ((NULL == query_key) || (NULL == data))
153 { 156 {
154 FPRINTF (stderr, "%s", _("Must provide KEY and DATA for DHT put!\n")); 157 FPRINTF (stderr, "%s", _("Must provide KEY and DATA for DHT put!\n"));
diff --git a/src/dht/gnunet-service-dht.c b/src/dht/gnunet-service-dht.c
index 1aeca9b85..a44be2dfe 100644
--- a/src/dht/gnunet-service-dht.c
+++ b/src/dht/gnunet-service-dht.c
@@ -161,9 +161,8 @@ run (void *cls, struct GNUNET_SERVER_Handle *server,
161 shutdown_task (NULL); 161 shutdown_task (NULL);
162 return; 162 return;
163 } 163 }
164 GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_FOREVER_REL, 164 GNUNET_SCHEDULER_add_shutdown (&shutdown_task,
165 &shutdown_task, 165 NULL);
166 NULL);
167 GDS_transport_handle = 166 GDS_transport_handle =
168 GNUNET_TRANSPORT_connect (GDS_cfg, NULL, NULL, NULL, NULL, NULL); 167 GNUNET_TRANSPORT_connect (GDS_cfg, NULL, NULL, NULL, NULL, NULL);
169 if (GDS_transport_handle == NULL) 168 if (GDS_transport_handle == NULL)
diff --git a/src/dht/gnunet-service-dht_clients.c b/src/dht/gnunet-service-dht_clients.c
index e42069fe0..a5757c25a 100644
--- a/src/dht/gnunet-service-dht_clients.c
+++ b/src/dht/gnunet-service-dht_clients.c
@@ -456,12 +456,8 @@ transmit_next_request_task (void *cls)
456{ 456{
457 struct ClientQueryRecord *cqr; 457 struct ClientQueryRecord *cqr;
458 struct GNUNET_TIME_Relative delay; 458 struct GNUNET_TIME_Relative delay;
459 const struct GNUNET_SCHEDULER_TaskContext *tc;
460 459
461 retry_task = NULL; 460 retry_task = NULL;
462 tc = GNUNET_SCHEDULER_get_task_context ();
463 if (0 != (tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN))
464 return;
465 while (NULL != (cqr = GNUNET_CONTAINER_heap_remove_root (retry_heap))) 461 while (NULL != (cqr = GNUNET_CONTAINER_heap_remove_root (retry_heap)))
466 { 462 {
467 cqr->hnode = NULL; 463 cqr->hnode = NULL;
diff --git a/src/dht/gnunet-service-dht_neighbours.c b/src/dht/gnunet-service-dht_neighbours.c
index d82effb34..8ab39c9aa 100644
--- a/src/dht/gnunet-service-dht_neighbours.c
+++ b/src/dht/gnunet-service-dht_neighbours.c
@@ -712,12 +712,8 @@ send_find_peer_message (void *cls)
712 struct GNUNET_TIME_Relative next_send_time; 712 struct GNUNET_TIME_Relative next_send_time;
713 struct BloomConstructorContext bcc; 713 struct BloomConstructorContext bcc;
714 struct GNUNET_CONTAINER_BloomFilter *peer_bf; 714 struct GNUNET_CONTAINER_BloomFilter *peer_bf;
715 const struct GNUNET_SCHEDULER_TaskContext *tc;
716 715
717 find_peer_task = NULL; 716 find_peer_task = NULL;
718 tc = GNUNET_SCHEDULER_get_task_context ();
719 if ((tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN) != 0)
720 return;
721 if (newly_found_peers > bucket_size) 717 if (newly_found_peers > bucket_size)
722 { 718 {
723 /* If we are finding many peers already, no need to send out our request right now! */ 719 /* If we are finding many peers already, no need to send out our request right now! */
@@ -2443,6 +2439,7 @@ GDS_NEIGHBOURS_done ()
2443 } 2439 }
2444} 2440}
2445 2441
2442
2446/** 2443/**
2447 * Get the ID of the local node. 2444 * Get the ID of the local node.
2448 * 2445 *
diff --git a/src/dht/gnunet-service-wdht.c b/src/dht/gnunet-service-wdht.c
index 0668c9078..b58bb729d 100644
--- a/src/dht/gnunet-service-wdht.c
+++ b/src/dht/gnunet-service-wdht.c
@@ -102,9 +102,8 @@ run (void *cls, struct GNUNET_SERVER_Handle *server,
102 shutdown_task (NULL); 102 shutdown_task (NULL);
103 return; 103 return;
104 } 104 }
105 GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_FOREVER_REL, 105 GNUNET_SCHEDULER_add_shutdown (&shutdown_task,
106 &shutdown_task, 106 NULL);
107 NULL);
108} 107}
109 108
110 109
diff --git a/src/dht/gnunet-service-wdht_clients.c b/src/dht/gnunet-service-wdht_clients.c
index c3aff03aa..8eb114660 100644
--- a/src/dht/gnunet-service-wdht_clients.c
+++ b/src/dht/gnunet-service-wdht_clients.c
@@ -880,12 +880,8 @@ transmit_next_request_task (void *cls)
880{ 880{
881 struct ClientQueryRecord *cqr; 881 struct ClientQueryRecord *cqr;
882 struct GNUNET_TIME_Relative delay; 882 struct GNUNET_TIME_Relative delay;
883 const struct GNUNET_SCHEDULER_TaskContext *tc;
884 883
885 retry_task = NULL; 884 retry_task = NULL;
886 tc = GNUNET_SCHEDULER_get_task_context ();
887 if (0 != (tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN))
888 return;
889 while (NULL != (cqr = GNUNET_CONTAINER_heap_remove_root (retry_heap))) 885 while (NULL != (cqr = GNUNET_CONTAINER_heap_remove_root (retry_heap)))
890 { 886 {
891 cqr->hnode = NULL; 887 cqr->hnode = NULL;
diff --git a/src/dht/gnunet-service-xdht.c b/src/dht/gnunet-service-xdht.c
index f6c7c5167..8a60a8d9d 100644
--- a/src/dht/gnunet-service-xdht.c
+++ b/src/dht/gnunet-service-xdht.c
@@ -17,14 +17,12 @@
17 Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 17 Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
18 Boston, MA 02110-1301, USA. 18 Boston, MA 02110-1301, USA.
19*/ 19*/
20
21/** 20/**
22 * @file dht/gnunet-service-xdht.c 21 * @file dht/gnunet-service-xdht.c
23 * @brief GNUnet DHT service 22 * @brief GNUnet DHT service
24 * @author Christian Grothoff 23 * @author Christian Grothoff
25 * @author Nathan Evans 24 * @author Nathan Evans
26 */ 25 */
27
28#include "platform.h" 26#include "platform.h"
29#include "gnunet_block_lib.h" 27#include "gnunet_block_lib.h"
30#include "gnunet_util_lib.h" 28#include "gnunet_util_lib.h"
@@ -125,9 +123,8 @@ run (void *cls, struct GNUNET_SERVER_Handle *server,
125 shutdown_task (NULL); 123 shutdown_task (NULL);
126 return; 124 return;
127 } 125 }
128 GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_FOREVER_REL, 126 GNUNET_SCHEDULER_add_shutdown (&shutdown_task,
129 &shutdown_task, 127 NULL);
130 NULL);
131} 128}
132 129
133 130
diff --git a/src/dht/gnunet-service-xdht_clients.c b/src/dht/gnunet-service-xdht_clients.c
index e08ccf792..3475d00c9 100644
--- a/src/dht/gnunet-service-xdht_clients.c
+++ b/src/dht/gnunet-service-xdht_clients.c
@@ -877,12 +877,8 @@ transmit_next_request_task (void *cls)
877{ 877{
878 struct ClientQueryRecord *cqr; 878 struct ClientQueryRecord *cqr;
879 struct GNUNET_TIME_Relative delay; 879 struct GNUNET_TIME_Relative delay;
880 const struct GNUNET_SCHEDULER_TaskContext *tc;
881 880
882 retry_task = NULL; 881 retry_task = NULL;
883 tc = GNUNET_SCHEDULER_get_task_context ();
884 if (0 != (tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN))
885 return;
886 while (NULL != (cqr = GNUNET_CONTAINER_heap_remove_root (retry_heap))) 882 while (NULL != (cqr = GNUNET_CONTAINER_heap_remove_root (retry_heap)))
887 { 883 {
888 cqr->hnode = NULL; 884 cqr->hnode = NULL;
diff --git a/src/dht/gnunet_dht_profiler.c b/src/dht/gnunet_dht_profiler.c
index f0c4ec7be..03ea62152 100644
--- a/src/dht/gnunet_dht_profiler.c
+++ b/src/dht/gnunet_dht_profiler.c
@@ -461,9 +461,21 @@ do_shutdown (void *cls)
461 a_ctx = NULL; 461 a_ctx = NULL;
462 } 462 }
463 //FIXME: Should we collect stats only for put/get not for other messages. 463 //FIXME: Should we collect stats only for put/get not for other messages.
464 if(NULL != bandwidth_stats_op) 464 if (NULL != bandwidth_stats_op)
465 {
465 GNUNET_TESTBED_operation_done (bandwidth_stats_op); 466 GNUNET_TESTBED_operation_done (bandwidth_stats_op);
466 bandwidth_stats_op = NULL; 467 bandwidth_stats_op = NULL;
468 }
469 if (NULL != successor_stats_op)
470 {
471 GNUNET_TESTBED_operation_done (successor_stats_op);
472 successor_stats_op = NULL;
473 }
474 if (NULL != successor_stats_task)
475 {
476 GNUNET_SCHEDULER_cancel (successor_stats_task);
477 successor_stats_task = NULL;
478 }
467 GNUNET_free_non_null (a_ac); 479 GNUNET_free_non_null (a_ac);
468} 480}
469 481
@@ -687,11 +699,7 @@ teardown_dht_connection (void *cls)
687{ 699{
688 struct Context *ctx = cls; 700 struct Context *ctx = cls;
689 struct GNUNET_TESTBED_Operation *op; 701 struct GNUNET_TESTBED_Operation *op;
690 const struct GNUNET_SCHEDULER_TaskContext *tc;
691 702
692 tc = GNUNET_SCHEDULER_get_task_context ();
693 if (0 != (GNUNET_SCHEDULER_REASON_SHUTDOWN & tc->reason))
694 return;
695 GNUNET_assert (NULL != ctx); 703 GNUNET_assert (NULL != ctx);
696 GNUNET_assert (NULL != (op = ctx->op)); 704 GNUNET_assert (NULL != (op = ctx->op));
697 ctx->op = NULL; 705 ctx->op = NULL;
@@ -1070,7 +1078,7 @@ successor_stats_cont (void *cls,
1070 successor_stats_op = NULL; 1078 successor_stats_op = NULL;
1071 if (0 == max_searches) 1079 if (0 == max_searches)
1072 { 1080 {
1073 start_func(); 1081 start_func ();
1074 return; 1082 return;
1075 } 1083 }
1076 1084
@@ -1108,39 +1116,27 @@ successor_stats_cont (void *cls,
1108 GNUNET_NO); 1116 GNUNET_NO);
1109 if ((start_val == val) && (count == num_peers)) 1117 if ((start_val == val) && (count == num_peers))
1110 { 1118 {
1111 DEBUG("CIRCLE COMPLETED after %u tries", tries); 1119 DEBUG ("CIRCLE COMPLETED after %u tries", tries);
1112 if(NULL == successor_stats_task) 1120 if(NULL == successor_stats_task)
1113 { 1121 {
1114 start_func(); 1122 start_func();
1115 } 1123 }
1116 return; 1124 return;
1117 } 1125 }
1118 else 1126 if (max_searches == ++tries)
1119 { 1127 {
1120 if (max_searches == ++tries) 1128 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
1121 { 1129 "Maximum tries %u exceeded while checking successor TOTAL TRIES %u"
1122 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 1130 " circle formation. Exiting\n",
1123 "Maximum tries %u exceeded while checking successor TOTAL TRIES %u" 1131 max_searches,tries);
1124 " circle formation. Exiting\n", 1132 start_func();
1125 max_searches,tries); 1133 return;
1126 if (NULL != successor_stats_task)
1127 {
1128 successor_stats_task = NULL;
1129 }
1130 if(NULL == successor_stats_task)
1131 {
1132 start_func();
1133 }
1134
1135 return;
1136 }
1137 else
1138 {
1139 flag = 0;
1140 successor_stats_task = GNUNET_SCHEDULER_add_delayed (delay_stats,
1141 &collect_stats, cls);
1142 }
1143 } 1134 }
1135 flag = 0;
1136 successor_stats_task
1137 = GNUNET_SCHEDULER_add_delayed (delay_stats,
1138 &collect_stats,
1139 cls);
1144} 1140}
1145 1141
1146 1142
@@ -1214,26 +1210,21 @@ successor_stats_iterator (void *cls,
1214static void 1210static void
1215collect_stats (void *cls) 1211collect_stats (void *cls)
1216{ 1212{
1217 const struct GNUNET_SCHEDULER_TaskContext *tc; 1213 successor_stats_task = NULL;
1218
1219 tc = GNUNET_SCHEDULER_get_task_context ();
1220 if ((GNUNET_SCHEDULER_REASON_SHUTDOWN & tc->reason) != 0)
1221 return;
1222
1223 GNUNET_log (GNUNET_ERROR_TYPE_INFO, 1214 GNUNET_log (GNUNET_ERROR_TYPE_INFO,
1224 "Start collecting statistics...\n"); 1215 "Start collecting statistics...\n");
1225 GNUNET_assert(NULL != testbed_handles); 1216 GNUNET_assert(NULL != testbed_handles);
1226 1217
1227 if (0 != max_searches) 1218 if (0 != max_searches)
1228 successor_peer_hashmap = GNUNET_CONTAINER_multihashmap_create (num_peers, 1219 successor_peer_hashmap
1229 GNUNET_NO); 1220 = GNUNET_CONTAINER_multihashmap_create (num_peers,
1230 successor_stats_op = 1221 GNUNET_NO);
1231 GNUNET_TESTBED_get_statistics (num_peers, testbed_handles, 1222 successor_stats_op
1232 "dht", NULL, 1223 = GNUNET_TESTBED_get_statistics (num_peers, testbed_handles,
1233 successor_stats_iterator, 1224 "dht", NULL,
1234 successor_stats_cont, cls); 1225 successor_stats_iterator,
1235 1226 successor_stats_cont, cls);
1236 GNUNET_assert(NULL != successor_stats_op); 1227 GNUNET_assert (NULL != successor_stats_op);
1237} 1228}
1238 1229
1239 1230
@@ -1265,9 +1256,10 @@ service_started (void *cls,
1265 collect_stat_cls->service_connect_ctx = cls; 1256 collect_stat_cls->service_connect_ctx = cls;
1266 collect_stat_cls->op = op; 1257 collect_stat_cls->op = op;
1267 1258
1268 successor_stats_task = GNUNET_SCHEDULER_add_delayed (delay_stats, 1259 successor_stats_task
1269 &collect_stats, 1260 = GNUNET_SCHEDULER_add_delayed (delay_stats,
1270 collect_stat_cls); 1261 &collect_stats,
1262 collect_stat_cls);
1271 } 1263 }
1272} 1264}
1273 1265
@@ -1393,7 +1385,8 @@ run (void *cls, char *const *args, const char *cfgfile,
1393 1385
1394 if (0 == num_peers) 1386 if (0 == num_peers)
1395 { 1387 {
1396 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, _("Exiting as the number of peers is %u\n"), 1388 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
1389 _("Exiting as the number of peers is %u\n"),
1397 num_peers); 1390 num_peers);
1398 return; 1391 return;
1399 } 1392 }
@@ -1401,8 +1394,8 @@ run (void *cls, char *const *args, const char *cfgfile,
1401 event_mask = 0; 1394 event_mask = 0;
1402 GNUNET_TESTBED_run (hosts_file, cfg, num_peers, event_mask, NULL, 1395 GNUNET_TESTBED_run (hosts_file, cfg, num_peers, event_mask, NULL,
1403 NULL, &test_run, NULL); 1396 NULL, &test_run, NULL);
1404 GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_FOREVER_REL, &do_shutdown, 1397 GNUNET_SCHEDULER_add_shutdown (&do_shutdown,
1405 NULL); 1398 NULL);
1406} 1399}
1407 1400
1408 1401