From: Christian Grothoff Date: Tue, 24 Jan 2012 14:42:51 +0000 (+0000) Subject: -bugfixes X-Git-Tag: initial-import-from-subversion-38251~15153 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=c5652406040cfcd7b183bbab8e963b57982f4bca;p=oweals%2Fgnunet.git -bugfixes --- diff --git a/src/vpn/test_gnunet_vpn.c b/src/vpn/test_gnunet_vpn.c index f75abac99..4d8ee7e9c 100644 --- a/src/vpn/test_gnunet_vpn.c +++ b/src/vpn/test_gnunet_vpn.c @@ -254,7 +254,13 @@ allocation_cb (void *cls, char ips[INET_ADDRSTRLEN]; rr = NULL; - GNUNET_assert (AF_INET == af); + if (AF_INET != af) + { + fprintf (stderr, +z "VPN failed to allocate appropriate address\n"); + GNUNET_SCHEDULER_shutdown (); + return; + } GNUNET_asprintf (&url, "http://%s:%u/hello_world", inet_ntop (af, address, ips, sizeof (ips)), @@ -341,9 +347,6 @@ mhd_main () &nws, &mhd_task, NULL); - ctrl_c_task_id = GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_FOREVER_REL, - &ctrl_c_shutdown, - NULL); } @@ -373,6 +376,9 @@ run (void *cls, char *const *args, const char *cfgfile, GNUNET_YES, GNUNET_TIME_UNIT_FOREVER_ABS, &allocation_cb, NULL); + ctrl_c_task_id = GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_FOREVER_REL, + &ctrl_c_shutdown, + NULL); } @@ -430,15 +436,6 @@ main (int argc, char *const *argv) GNUNET_GETOPT_OPTION_END }; - /* not technically true -- proper SUID and a chdir here would - likely do -- but this will avoid getting (useless) reports - from users where the test fails due to insufficient - permissions */ - if (0 != getuid ()) - { - fprintf (stderr, "This testcase can only be run as root\n"); - return 0; - } if (0 != curl_global_init (CURL_GLOBAL_WIN32)) return 2; setup_peer (&p1, "test_gnunet_vpn.conf"); @@ -452,5 +449,6 @@ main (int argc, char *const *argv) GNUNET_PROGRAM_run ((sizeof (argvx) / sizeof (char *)) - 1, argvx, "test_gnunet_vpn", "nohelp", options, &run, NULL); stop_peer (&p1); + GNUNET_DISK_directory_remove ("/tmp/gnunet-test-vpn"); return global_ret; } diff --git a/src/vpn/vpn_api.c b/src/vpn/vpn_api.c index 3f8d04523..494c6d857 100644 --- a/src/vpn/vpn_api.c +++ b/src/vpn/vpn_api.c @@ -261,9 +261,13 @@ transmit_request (void *cls, while ( (NULL != rr) && (0 != rr->request_id) ) rr = rr->next; - if ( (NULL == rr) || - (0 == size) ) + if (NULL == rr) return 0; + if (0 == size) + { + reconnect (vh); + return 0; + } /* if first request, start receive loop */ if (0 == vh->request_id_gen) @@ -364,9 +368,10 @@ connect_task (void *cls, { struct GNUNET_VPN_Handle *vh = cls; + vh->rt = GNUNET_SCHEDULER_NO_TASK; vh->client = GNUNET_CLIENT_connect ("vpn", vh->cfg); GNUNET_assert (NULL != vh->client); - GNUNET_assert (NULL != vh->th); + GNUNET_assert (NULL == vh->th); if (NULL != vh->rr_head) vh->th = GNUNET_CLIENT_notify_transmit_ready (vh->client, sizeof (struct RedirectToServiceRequestMessage),