aboutsummaryrefslogtreecommitdiff
path: root/src/mesh/gnunet-regex-profiler.c
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2012-11-05 09:17:33 +0000
committerChristian Grothoff <christian@grothoff.org>2012-11-05 09:17:33 +0000
commit311c500cfcfe294dc0eb8f473ade799f4fda1342 (patch)
treee74c81eb078a0b10e2f1b788788ce331551898b0 /src/mesh/gnunet-regex-profiler.c
parent56c52d5803111f9a220e43e58cb93d04880d3894 (diff)
downloadgnunet-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.c75
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 */
116static struct GNUNET_TESTBED_Host **hosts;
117
118/**
119 * Peer handles. 114 * Peer handles.
120 */ 115 */
121struct RegexPeer 116struct 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 */
186static 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 */
191struct GNUNET_TESTBED_Peer **peer_handles; 192static 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 */
206struct GNUNET_TESTBED_ControllerProc *mc_proc; 207static struct GNUNET_TESTBED_ControllerProc *mc_proc;
207 208
208/** 209/**
209 * Handle to the master controller 210 * Handle to the master controller
210 */ 211 */
211struct GNUNET_TESTBED_Controller *mc; 212static struct GNUNET_TESTBED_Controller *mc;
212 213
213/** 214/**
214 * Handle to global configuration 215 * Handle to global configuration
215 */ 216 */
216struct GNUNET_CONFIGURATION_Handle *cfg; 217static struct GNUNET_CONFIGURATION_Handle *cfg;
217 218
218/** 219/**
219 * Head of the operations list 220 * Head of the operations list
220 */ 221 */
221struct DLLOperation *dll_op_head; 222static struct DLLOperation *dll_op_head;
222 223
223/** 224/**
224 * Tail of the operations list 225 * Tail of the operations list
225 */ 226 */
226struct DLLOperation *dll_op_tail; 227static struct DLLOperation *dll_op_tail;
227 228
228/** 229/**
229 * Peer linking - topology operation 230 * Peer linking - topology operation
230 */ 231 */
231struct GNUNET_TESTBED_Operation *topology_op; 232static 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 */
246uint64_t event_mask; 247static 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 */
251struct GNUNET_TIME_Absolute prof_start_time; 252static 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 */
256struct GNUNET_TIME_Relative prof_time; 257static struct GNUNET_TIME_Relative prof_time;
257 258
258/** 259/**
259 * Current peer id 260 * Current peer id
260 */ 261 */
261unsigned int peer_id; 262static 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 */
382void 383static void
383mesh_peer_connect_handler (void *cls, 384mesh_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 */
398void 399static void
399mesh_peer_disconnect_handler (void *cls, 400mesh_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 */
410void 411static void
411mesh_connect_cb (void *cls, struct GNUNET_TESTBED_Operation *op, 412mesh_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 */
422void * 423static void *
423mesh_ca (void *cls, const struct GNUNET_CONFIGURATION_Handle *cfg); 424mesh_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 */
433void 434static void
434mesh_da (void *cls, void *op_result); 435mesh_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 */
718void * 719static void *
719mesh_inbound_tunnel_handler (void *cls, struct GNUNET_MESH_Tunnel *tunnel, 720mesh_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 */
741void 742static void
742mesh_tunnel_end_handler (void *cls, const struct GNUNET_MESH_Tunnel *tunnel, 743mesh_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 */
759void 760static void
760mesh_peer_disconnect_handler (void *cls, 761mesh_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 */
775void 776static void
776mesh_peer_connect_handler (void *cls, 777mesh_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 */
979void 980static void
980mesh_connect_cb (void *cls, struct GNUNET_TESTBED_Operation *op, 981mesh_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 */
1105void * 1106static void *
1106mesh_ca (void *cls, const struct GNUNET_CONFIGURATION_Handle *cfg) 1107mesh_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 */
1131void 1132static void
1132mesh_da (void *cls, void *op_result) 1133mesh_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 */
1315int 1317static int
1316policy_filename_cb (void *cls, const char *filename) 1318policy_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 */