diff options
author | Christian Grothoff <christian@grothoff.org> | 2012-11-05 09:17:33 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2012-11-05 09:17:33 +0000 |
commit | 311c500cfcfe294dc0eb8f473ade799f4fda1342 (patch) | |
tree | e74c81eb078a0b10e2f1b788788ce331551898b0 /src/mesh/gnunet-regex-profiler.c | |
parent | 56c52d5803111f9a220e43e58cb93d04880d3894 (diff) | |
download | gnunet-311c500cfcfe294dc0eb8f473ade799f4fda1342.tar.gz gnunet-311c500cfcfe294dc0eb8f473ade799f4fda1342.zip |
-fix missing check of return value
Diffstat (limited to 'src/mesh/gnunet-regex-profiler.c')
-rw-r--r-- | src/mesh/gnunet-regex-profiler.c | 75 |
1 files changed, 43 insertions, 32 deletions
diff --git a/src/mesh/gnunet-regex-profiler.c b/src/mesh/gnunet-regex-profiler.c index 1669666d0..d45d8a650 100644 --- a/src/mesh/gnunet-regex-profiler.c +++ b/src/mesh/gnunet-regex-profiler.c | |||
@@ -111,11 +111,6 @@ enum State | |||
111 | 111 | ||
112 | 112 | ||
113 | /** | 113 | /** |
114 | * An array of hosts loaded from the hostkeys file | ||
115 | */ | ||
116 | static struct GNUNET_TESTBED_Host **hosts; | ||
117 | |||
118 | /** | ||
119 | * Peer handles. | 114 | * Peer handles. |
120 | */ | 115 | */ |
121 | struct RegexPeer | 116 | struct RegexPeer |
@@ -184,11 +179,17 @@ struct RegexPeer | |||
184 | struct GNUNET_TIME_Absolute prof_start_time; | 179 | struct GNUNET_TIME_Absolute prof_start_time; |
185 | }; | 180 | }; |
186 | 181 | ||
182 | |||
183 | /** | ||
184 | * An array of hosts loaded from the hostkeys file | ||
185 | */ | ||
186 | static struct GNUNET_TESTBED_Host **hosts; | ||
187 | |||
187 | /** | 188 | /** |
188 | * Array of peer handles used to pass to | 189 | * Array of peer handles used to pass to |
189 | * GNUNET_TESTBED_overlay_configure_topology | 190 | * GNUNET_TESTBED_overlay_configure_topology |
190 | */ | 191 | */ |
191 | struct GNUNET_TESTBED_Peer **peer_handles; | 192 | static struct GNUNET_TESTBED_Peer **peer_handles; |
192 | 193 | ||
193 | /** | 194 | /** |
194 | * The array of peers; we fill this as the peers are given to us by the testbed | 195 | * The array of peers; we fill this as the peers are given to us by the testbed |
@@ -203,32 +204,32 @@ static struct GNUNET_TESTBED_HostRegistrationHandle *reg_handle; | |||
203 | /** | 204 | /** |
204 | * Handle to the master controller process | 205 | * Handle to the master controller process |
205 | */ | 206 | */ |
206 | struct GNUNET_TESTBED_ControllerProc *mc_proc; | 207 | static struct GNUNET_TESTBED_ControllerProc *mc_proc; |
207 | 208 | ||
208 | /** | 209 | /** |
209 | * Handle to the master controller | 210 | * Handle to the master controller |
210 | */ | 211 | */ |
211 | struct GNUNET_TESTBED_Controller *mc; | 212 | static struct GNUNET_TESTBED_Controller *mc; |
212 | 213 | ||
213 | /** | 214 | /** |
214 | * Handle to global configuration | 215 | * Handle to global configuration |
215 | */ | 216 | */ |
216 | struct GNUNET_CONFIGURATION_Handle *cfg; | 217 | static struct GNUNET_CONFIGURATION_Handle *cfg; |
217 | 218 | ||
218 | /** | 219 | /** |
219 | * Head of the operations list | 220 | * Head of the operations list |
220 | */ | 221 | */ |
221 | struct DLLOperation *dll_op_head; | 222 | static struct DLLOperation *dll_op_head; |
222 | 223 | ||
223 | /** | 224 | /** |
224 | * Tail of the operations list | 225 | * Tail of the operations list |
225 | */ | 226 | */ |
226 | struct DLLOperation *dll_op_tail; | 227 | static struct DLLOperation *dll_op_tail; |
227 | 228 | ||
228 | /** | 229 | /** |
229 | * Peer linking - topology operation | 230 | * Peer linking - topology operation |
230 | */ | 231 | */ |
231 | struct GNUNET_TESTBED_Operation *topology_op; | 232 | static struct GNUNET_TESTBED_Operation *topology_op; |
232 | 233 | ||
233 | /** | 234 | /** |
234 | * Abort task identifier | 235 | * Abort task identifier |
@@ -243,22 +244,22 @@ static GNUNET_SCHEDULER_TaskIdentifier register_hosts_task; | |||
243 | /** | 244 | /** |
244 | * Global event mask for all testbed events | 245 | * Global event mask for all testbed events |
245 | */ | 246 | */ |
246 | uint64_t event_mask; | 247 | static uint64_t event_mask; |
247 | 248 | ||
248 | /** | 249 | /** |
249 | * The starting time of a profiling step | 250 | * The starting time of a profiling step |
250 | */ | 251 | */ |
251 | struct GNUNET_TIME_Absolute prof_start_time; | 252 | static struct GNUNET_TIME_Absolute prof_start_time; |
252 | 253 | ||
253 | /** | 254 | /** |
254 | * Duration profiling step has taken | 255 | * Duration profiling step has taken |
255 | */ | 256 | */ |
256 | struct GNUNET_TIME_Relative prof_time; | 257 | static struct GNUNET_TIME_Relative prof_time; |
257 | 258 | ||
258 | /** | 259 | /** |
259 | * Current peer id | 260 | * Current peer id |
260 | */ | 261 | */ |
261 | unsigned int peer_id; | 262 | static unsigned int peer_id; |
262 | 263 | ||
263 | /** | 264 | /** |
264 | * Number of peers to be started by the profiler | 265 | * Number of peers to be started by the profiler |
@@ -379,7 +380,7 @@ static unsigned int max_path_compression; | |||
379 | * @param atsi performance data for the connection | 380 | * @param atsi performance data for the connection |
380 | * | 381 | * |
381 | */ | 382 | */ |
382 | void | 383 | static void |
383 | mesh_peer_connect_handler (void *cls, | 384 | mesh_peer_connect_handler (void *cls, |
384 | const struct GNUNET_PeerIdentity* peer_id, | 385 | const struct GNUNET_PeerIdentity* peer_id, |
385 | const struct GNUNET_ATS_Information * atsi); | 386 | const struct GNUNET_ATS_Information * atsi); |
@@ -395,7 +396,7 @@ mesh_peer_connect_handler (void *cls, | |||
395 | * @param cls closure | 396 | * @param cls closure |
396 | * @param peer_id peer identity the tunnel stopped working with | 397 | * @param peer_id peer identity the tunnel stopped working with |
397 | */ | 398 | */ |
398 | void | 399 | static void |
399 | mesh_peer_disconnect_handler (void *cls, | 400 | mesh_peer_disconnect_handler (void *cls, |
400 | const struct GNUNET_PeerIdentity * peer_id); | 401 | const struct GNUNET_PeerIdentity * peer_id); |
401 | 402 | ||
@@ -407,7 +408,7 @@ mesh_peer_disconnect_handler (void *cls, | |||
407 | * @param ca_result connect adapter result. | 408 | * @param ca_result connect adapter result. |
408 | * @param emsg error message. | 409 | * @param emsg error message. |
409 | */ | 410 | */ |
410 | void | 411 | static void |
411 | mesh_connect_cb (void *cls, struct GNUNET_TESTBED_Operation *op, | 412 | mesh_connect_cb (void *cls, struct GNUNET_TESTBED_Operation *op, |
412 | void *ca_result, const char *emsg); | 413 | void *ca_result, const char *emsg); |
413 | 414 | ||
@@ -419,7 +420,7 @@ mesh_connect_cb (void *cls, struct GNUNET_TESTBED_Operation *op, | |||
419 | * | 420 | * |
420 | * @return | 421 | * @return |
421 | */ | 422 | */ |
422 | void * | 423 | static void * |
423 | mesh_ca (void *cls, const struct GNUNET_CONFIGURATION_Handle *cfg); | 424 | mesh_ca (void *cls, const struct GNUNET_CONFIGURATION_Handle *cfg); |
424 | 425 | ||
425 | 426 | ||
@@ -430,7 +431,7 @@ mesh_ca (void *cls, const struct GNUNET_CONFIGURATION_Handle *cfg); | |||
430 | * @param cls closure | 431 | * @param cls closure |
431 | * @param op_result service handle returned from the connect adapter | 432 | * @param op_result service handle returned from the connect adapter |
432 | */ | 433 | */ |
433 | void | 434 | static void |
434 | mesh_da (void *cls, void *op_result); | 435 | mesh_da (void *cls, void *op_result); |
435 | 436 | ||
436 | 437 | ||
@@ -715,7 +716,7 @@ stats_connect_cb (void *cls, | |||
715 | * @return initial tunnel context for the tunnel | 716 | * @return initial tunnel context for the tunnel |
716 | * (can be NULL -- that's not an error) | 717 | * (can be NULL -- that's not an error) |
717 | */ | 718 | */ |
718 | void * | 719 | static void * |
719 | mesh_inbound_tunnel_handler (void *cls, struct GNUNET_MESH_Tunnel *tunnel, | 720 | mesh_inbound_tunnel_handler (void *cls, struct GNUNET_MESH_Tunnel *tunnel, |
720 | const struct GNUNET_PeerIdentity *initiator, | 721 | const struct GNUNET_PeerIdentity *initiator, |
721 | const struct GNUNET_ATS_Information *atsi) | 722 | const struct GNUNET_ATS_Information *atsi) |
@@ -738,7 +739,7 @@ mesh_inbound_tunnel_handler (void *cls, struct GNUNET_MESH_Tunnel *tunnel, | |||
738 | * @param tunnel_ctx place where local state associated | 739 | * @param tunnel_ctx place where local state associated |
739 | * with the tunnel is stored | 740 | * with the tunnel is stored |
740 | */ | 741 | */ |
741 | void | 742 | static void |
742 | mesh_tunnel_end_handler (void *cls, const struct GNUNET_MESH_Tunnel *tunnel, | 743 | mesh_tunnel_end_handler (void *cls, const struct GNUNET_MESH_Tunnel *tunnel, |
743 | void *tunnel_ctx) | 744 | void *tunnel_ctx) |
744 | { | 745 | { |
@@ -756,7 +757,7 @@ mesh_tunnel_end_handler (void *cls, const struct GNUNET_MESH_Tunnel *tunnel, | |||
756 | * @param cls closure | 757 | * @param cls closure |
757 | * @param peer_id peer identity the tunnel stopped working with | 758 | * @param peer_id peer identity the tunnel stopped working with |
758 | */ | 759 | */ |
759 | void | 760 | static void |
760 | mesh_peer_disconnect_handler (void *cls, | 761 | mesh_peer_disconnect_handler (void *cls, |
761 | const struct GNUNET_PeerIdentity * peer_id) | 762 | const struct GNUNET_PeerIdentity * peer_id) |
762 | { | 763 | { |
@@ -772,7 +773,7 @@ mesh_peer_disconnect_handler (void *cls, | |||
772 | * @param atsi performance data for the connection | 773 | * @param atsi performance data for the connection |
773 | * | 774 | * |
774 | */ | 775 | */ |
775 | void | 776 | static void |
776 | mesh_peer_connect_handler (void *cls, | 777 | mesh_peer_connect_handler (void *cls, |
777 | const struct GNUNET_PeerIdentity* peer_id, | 778 | const struct GNUNET_PeerIdentity* peer_id, |
778 | const struct GNUNET_ATS_Information * atsi) | 779 | const struct GNUNET_ATS_Information * atsi) |
@@ -976,7 +977,7 @@ do_mesh_op_done (void *cls, | |||
976 | * @param ca_result connect adapter result. | 977 | * @param ca_result connect adapter result. |
977 | * @param emsg error message. | 978 | * @param emsg error message. |
978 | */ | 979 | */ |
979 | void | 980 | static void |
980 | mesh_connect_cb (void *cls, struct GNUNET_TESTBED_Operation *op, | 981 | mesh_connect_cb (void *cls, struct GNUNET_TESTBED_Operation *op, |
981 | void *ca_result, const char *emsg) | 982 | void *ca_result, const char *emsg) |
982 | { | 983 | { |
@@ -1102,7 +1103,7 @@ mesh_connect_cb (void *cls, struct GNUNET_TESTBED_Operation *op, | |||
1102 | * | 1103 | * |
1103 | * @return | 1104 | * @return |
1104 | */ | 1105 | */ |
1105 | void * | 1106 | static void * |
1106 | mesh_ca (void *cls, const struct GNUNET_CONFIGURATION_Handle *cfg) | 1107 | mesh_ca (void *cls, const struct GNUNET_CONFIGURATION_Handle *cfg) |
1107 | { | 1108 | { |
1108 | GNUNET_MESH_ApplicationType app; | 1109 | GNUNET_MESH_ApplicationType app; |
@@ -1128,7 +1129,7 @@ mesh_ca (void *cls, const struct GNUNET_CONFIGURATION_Handle *cfg) | |||
1128 | * @param cls closure | 1129 | * @param cls closure |
1129 | * @param op_result service handle returned from the connect adapter | 1130 | * @param op_result service handle returned from the connect adapter |
1130 | */ | 1131 | */ |
1131 | void | 1132 | static void |
1132 | mesh_da (void *cls, void *op_result) | 1133 | mesh_da (void *cls, void *op_result) |
1133 | { | 1134 | { |
1134 | struct RegexPeer *peer = (struct RegexPeer *) cls; | 1135 | struct RegexPeer *peer = (struct RegexPeer *) cls; |
@@ -1304,6 +1305,7 @@ peer_create_cb (void *cls, struct GNUNET_TESTBED_Peer *peer, const char *emsg) | |||
1304 | } | 1305 | } |
1305 | } | 1306 | } |
1306 | 1307 | ||
1308 | |||
1307 | /** | 1309 | /** |
1308 | * Function called with a filename. | 1310 | * Function called with a filename. |
1309 | * | 1311 | * |
@@ -1312,7 +1314,7 @@ peer_create_cb (void *cls, struct GNUNET_TESTBED_Peer *peer, const char *emsg) | |||
1312 | * @return GNUNET_OK to continue to iterate, | 1314 | * @return GNUNET_OK to continue to iterate, |
1313 | * GNUNET_SYSERR to abort iteration with error! | 1315 | * GNUNET_SYSERR to abort iteration with error! |
1314 | */ | 1316 | */ |
1315 | int | 1317 | static int |
1316 | policy_filename_cb (void *cls, const char *filename) | 1318 | policy_filename_cb (void *cls, const char *filename) |
1317 | { | 1319 | { |
1318 | static unsigned int peer_cnt; | 1320 | static unsigned int peer_cnt; |
@@ -1354,6 +1356,7 @@ controller_event_cb (void *cls, | |||
1354 | { | 1356 | { |
1355 | struct DLLOperation *dll_op; | 1357 | struct DLLOperation *dll_op; |
1356 | struct GNUNET_TESTBED_Operation *op; | 1358 | struct GNUNET_TESTBED_Operation *op; |
1359 | int ret; | ||
1357 | 1360 | ||
1358 | switch (state) | 1361 | switch (state) |
1359 | { | 1362 | { |
@@ -1389,9 +1392,17 @@ controller_event_cb (void *cls, | |||
1389 | state = STATE_PEERS_CREATING; | 1392 | state = STATE_PEERS_CREATING; |
1390 | prof_start_time = GNUNET_TIME_absolute_get (); | 1393 | prof_start_time = GNUNET_TIME_absolute_get (); |
1391 | 1394 | ||
1392 | num_peers = GNUNET_DISK_directory_scan (policy_dir, | 1395 | if (-1 == (ret = GNUNET_DISK_directory_scan (policy_dir, |
1393 | NULL, | 1396 | NULL, |
1394 | NULL); | 1397 | NULL))) |
1398 | { | ||
1399 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, | ||
1400 | _("No files found in `%s'\n"), | ||
1401 | policy_dir); | ||
1402 | GNUNET_SCHEDULER_shutdown (); | ||
1403 | return; | ||
1404 | } | ||
1405 | num_peers = (unsigned int) ret; | ||
1395 | peers = GNUNET_malloc (sizeof (struct RegexPeer) * num_peers); | 1406 | peers = GNUNET_malloc (sizeof (struct RegexPeer) * num_peers); |
1396 | 1407 | ||
1397 | /* Initialize peers */ | 1408 | /* Initialize peers */ |