aboutsummaryrefslogtreecommitdiff
path: root/src/transport/gnunet-transport.c
diff options
context:
space:
mode:
authorMatthias Wachs <wachs@net.in.tum.de>2013-01-17 12:25:33 +0000
committerMatthias Wachs <wachs@net.in.tum.de>2013-01-17 12:25:33 +0000
commita5d7b80e7e64f3127fd703b52928aa337f4337f5 (patch)
treedc3ea87e8bf744968997cbe6477dff44921760d9 /src/transport/gnunet-transport.c
parent50cd87d210493d53a14e4e400a929074da775a64 (diff)
downloadgnunet-a5d7b80e7e64f3127fd703b52928aa337f4337f5.tar.gz
gnunet-a5d7b80e7e64f3127fd703b52928aa337f4337f5.zip
timeout for address listing
Diffstat (limited to 'src/transport/gnunet-transport.c')
-rw-r--r--src/transport/gnunet-transport.c28
1 files changed, 27 insertions, 1 deletions
diff --git a/src/transport/gnunet-transport.c b/src/transport/gnunet-transport.c
index 4e251a009..ecb26ca89 100644
--- a/src/transport/gnunet-transport.c
+++ b/src/transport/gnunet-transport.c
@@ -280,7 +280,8 @@ operation_timeout (void *cls,
280 const struct GNUNET_SCHEDULER_TaskContext *tc) 280 const struct GNUNET_SCHEDULER_TaskContext *tc)
281{ 281{
282 op_timeout = GNUNET_SCHEDULER_NO_TASK; 282 op_timeout = GNUNET_SCHEDULER_NO_TASK;
283 if ((try_connect) || (benchmark_send) || (benchmark_receive)) 283 if ((try_connect) || (benchmark_send) ||
284 (benchmark_receive))
284 { 285 {
285 FPRINTF (stdout, _("Failed to connect to `%s'\n"), GNUNET_h2s_full (&pid.hashPubKey)); 286 FPRINTF (stdout, _("Failed to connect to `%s'\n"), GNUNET_h2s_full (&pid.hashPubKey));
286 if (GNUNET_SCHEDULER_NO_TASK != end) 287 if (GNUNET_SCHEDULER_NO_TASK != end)
@@ -289,6 +290,16 @@ operation_timeout (void *cls,
289 ret = 1; 290 ret = 1;
290 return; 291 return;
291 } 292 }
293 if (iterate_connections)
294 {
295 FPRINTF (stdout, _("Failed to list connections, timeout occured\n"));
296 if (GNUNET_SCHEDULER_NO_TASK != end)
297 GNUNET_SCHEDULER_cancel (end);
298 end = GNUNET_SCHEDULER_add_now (&shutdown_task, NULL);
299 ret = 1;
300 return;
301 }
302
292} 303}
293 304
294 305
@@ -661,7 +672,15 @@ process_string (void *cls, const char *address)
661 if ((0 == address_resolutions) && (iterate_connections)) 672 if ((0 == address_resolutions) && (iterate_connections))
662 { 673 {
663 if (GNUNET_SCHEDULER_NO_TASK != end) 674 if (GNUNET_SCHEDULER_NO_TASK != end)
675 {
664 GNUNET_SCHEDULER_cancel (end); 676 GNUNET_SCHEDULER_cancel (end);
677 end = GNUNET_SCHEDULER_NO_TASK;
678 }
679 if (GNUNET_SCHEDULER_NO_TASK != op_timeout)
680 {
681 GNUNET_SCHEDULER_cancel (op_timeout);
682 op_timeout = GNUNET_SCHEDULER_NO_TASK;
683 }
665 ret = 0; 684 ret = 0;
666 end = GNUNET_SCHEDULER_add_now (&shutdown_task, NULL); 685 end = GNUNET_SCHEDULER_add_now (&shutdown_task, NULL);
667 } 686 }
@@ -695,6 +714,11 @@ process_address (void *cls, const struct GNUNET_PeerIdentity *peer,
695 return; 714 return;
696 } 715 }
697 716
717 if (GNUNET_SCHEDULER_NO_TASK != op_timeout)
718 GNUNET_SCHEDULER_cancel (op_timeout);
719 op_timeout = GNUNET_SCHEDULER_add_delayed (OP_TIMEOUT,
720 &operation_timeout, NULL);
721
698 rc = GNUNET_malloc(sizeof (struct ResolutionContext)); 722 rc = GNUNET_malloc(sizeof (struct ResolutionContext));
699 rc->addrcp = GNUNET_HELLO_address_copy(address); 723 rc->addrcp = GNUNET_HELLO_address_copy(address);
700 rc->printed = GNUNET_NO; 724 rc->printed = GNUNET_NO;
@@ -852,6 +876,8 @@ testservice_task (void *cls,
852 GNUNET_YES, 876 GNUNET_YES,
853 TIMEOUT, 877 TIMEOUT,
854 &process_address, (void *) cfg); 878 &process_address, (void *) cfg);
879 op_timeout = GNUNET_SCHEDULER_add_delayed (OP_TIMEOUT,
880 &operation_timeout, NULL);
855 } 881 }
856 else if (monitor_connections) /* -m: List all active addresses continously */ 882 else if (monitor_connections) /* -m: List all active addresses continously */
857 { 883 {