[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r37444 - gnunet/src/pt
From: |
gnunet |
Subject: |
[GNUnet-SVN] r37444 - gnunet/src/pt |
Date: |
Sat, 2 Jul 2016 22:00:00 +0200 |
Author: grothoff
Date: 2016-07-02 22:00:00 +0200 (Sat, 02 Jul 2016)
New Revision: 37444
Modified:
gnunet/src/pt/test_gns_vpn.c
gnunet/src/pt/test_gnunet_vpn.c
Log:
-fix testcase shutdown
Modified: gnunet/src/pt/test_gns_vpn.c
===================================================================
--- gnunet/src/pt/test_gns_vpn.c 2016-07-02 19:58:12 UTC (rev 37443)
+++ gnunet/src/pt/test_gns_vpn.c 2016-07-02 20:00:00 UTC (rev 37444)
@@ -54,6 +54,8 @@
static struct GNUNET_SCHEDULER_Task *curl_task_id;
+static struct GNUNET_SCHEDULER_Task *timeout_task;
+
static struct GNUNET_IDENTITY_Handle *identity;
static struct GNUNET_NAMESTORE_QueueEntry *qe;
@@ -142,16 +144,21 @@
static void
do_shutdown (void *cls)
{
- if (mhd_task_id != NULL)
+ if (NULL != mhd_task_id)
{
GNUNET_SCHEDULER_cancel (mhd_task_id);
mhd_task_id = NULL;
}
- if (curl_task_id != NULL)
+ if (NULL != curl_task_id)
{
GNUNET_SCHEDULER_cancel (curl_task_id);
curl_task_id = NULL;
}
+ if (NULL != timeout_task)
+ {
+ GNUNET_SCHEDULER_cancel (timeout_task);
+ timeout_task = NULL;
+ }
if (NULL != mhd)
{
MHD_stop_daemon (mhd);
@@ -172,6 +179,14 @@
}
+static void
+do_timeout (void *cls)
+{
+ timeout_task = NULL;
+ GNUNET_SCHEDULER_shutdown ();
+}
+
+
/**
* Function to run the HTTP client.
*/
@@ -236,7 +251,8 @@
GNUNET_break (0);
global_ret = 3;
}
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Download complete, shutting
down!\n");
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+ "Download complete, shutting down!\n");
GNUNET_SCHEDULER_shutdown ();
return;
}
@@ -622,9 +638,11 @@
NULL
};
GNUNET_TESTING_peer_get_identity (peer, &id);
- GNUNET_SCHEDULER_add_delayed (TIMEOUT,
- &do_shutdown,
- NULL);
+ GNUNET_SCHEDULER_add_shutdown (&do_shutdown,
+ NULL);
+ timeout_task = GNUNET_SCHEDULER_add_delayed (TIMEOUT,
+ &do_timeout,
+ NULL);
bin = GNUNET_OS_installation_get_path (GNUNET_OS_IPK_BINDIR);
GNUNET_asprintf (&bin_identity,
"%s/%s",
Modified: gnunet/src/pt/test_gnunet_vpn.c
===================================================================
--- gnunet/src/pt/test_gnunet_vpn.c 2016-07-02 19:58:12 UTC (rev 37443)
+++ gnunet/src/pt/test_gnunet_vpn.c 2016-07-02 20:00:00 UTC (rev 37444)
@@ -47,11 +47,11 @@
static struct MHD_Daemon *mhd;
-static struct GNUNET_SCHEDULER_Task * mhd_task_id;
+static struct GNUNET_SCHEDULER_Task *mhd_task_id;
-static struct GNUNET_SCHEDULER_Task * curl_task_id;
+static struct GNUNET_SCHEDULER_Task *curl_task_id;
-static struct GNUNET_SCHEDULER_Task * ctrl_c_task_id;
+static struct GNUNET_SCHEDULER_Task *timeout_task_id;
static struct GNUNET_VPN_RedirectionRequest *rr;
@@ -100,9 +100,14 @@
static int
-mhd_ahc (void *cls, struct MHD_Connection *connection, const char *url,
- const char *method, const char *version, const char *upload_data,
- size_t * upload_data_size, void **unused)
+mhd_ahc (void *cls,
+ struct MHD_Connection *connection,
+ const char *url,
+ const char *method,
+ const char *version,
+ const char *upload_data,
+ size_t * upload_data_size,
+ void **unused)
{
static int ptr;
struct MHD_Response *response;
@@ -130,22 +135,22 @@
static void
-do_shutdown ()
+do_shutdown (void *cls)
{
- if (mhd_task_id != NULL)
+ if (NULL != mhd_task_id)
{
GNUNET_SCHEDULER_cancel (mhd_task_id);
mhd_task_id = NULL;
}
- if (curl_task_id != NULL)
+ if (NULL != curl_task_id)
{
GNUNET_SCHEDULER_cancel (curl_task_id);
curl_task_id = NULL;
}
- if (ctrl_c_task_id != NULL)
+ if (NULL != timeout_task_id)
{
- GNUNET_SCHEDULER_cancel (ctrl_c_task_id);
- ctrl_c_task_id = NULL;
+ GNUNET_SCHEDULER_cancel (timeout_task_id);
+ timeout_task_id = NULL;
}
if (NULL != mhd)
{
@@ -220,7 +225,7 @@
global_ret = 3;
}
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Download complete, shutting
down!\n");
- do_shutdown ();
+ GNUNET_SCHEDULER_shutdown ();
return;
}
GNUNET_assert (CURLM_OK == curl_multi_fdset (multi, &rs, &ws, &es, &max));
@@ -259,7 +264,8 @@
rr = NULL;
if (src_af != af)
{
- fprintf (stderr, "VPN failed to allocate appropriate address\n");
+ fprintf (stderr,
+ "VPN failed to allocate appropriate address\n");
GNUNET_SCHEDULER_shutdown ();
return;
}
@@ -266,12 +272,18 @@
if (AF_INET6 == af)
GNUNET_asprintf (&url,
"http://[%s]:%u/hello_world",
- inet_ntop (af, address, ips, sizeof (ips)),
+ inet_ntop (af,
+ address,
+ ips,
+ sizeof (ips)),
(unsigned int) PORT);
else
GNUNET_asprintf (&url,
"http://%s:%u/hello_world",
- inet_ntop (af, address, ips, sizeof (ips)),
+ inet_ntop (af,
+ address,
+ ips,
+ sizeof (ips)),
(unsigned int) PORT);
curl = curl_easy_init ();
curl_easy_setopt (curl, CURLOPT_URL, url);
@@ -312,10 +324,10 @@
static void
-ctrl_c_shutdown (void *cls)
+do_timeout (void *cls)
{
- ctrl_c_task_id = NULL;
- do_shutdown ();
+ timeout_task_id = NULL;
+ GNUNET_SCHEDULER_shutdown ();
GNUNET_break (0);
global_ret = 1;
}
@@ -392,8 +404,12 @@
rr = GNUNET_VPN_redirect_to_ip (vpn, src_af, dest_af, addr,
GNUNET_TIME_UNIT_FOREVER_ABS, &allocation_cb,
NULL);
- ctrl_c_task_id =
- GNUNET_SCHEDULER_add_delayed (TIMEOUT, &ctrl_c_shutdown, NULL);
+ timeout_task_id =
+ GNUNET_SCHEDULER_add_delayed (TIMEOUT,
+ &do_timeout,
+ NULL);
+ GNUNET_SCHEDULER_add_shutdown (&do_shutdown,
+ NULL);
}
@@ -409,7 +425,8 @@
#ifndef MINGW
if (0 != ACCESS ("/dev/net/tun", R_OK))
{
- GNUNET_log_strerror_file (GNUNET_ERROR_TYPE_ERROR, "access",
+ GNUNET_log_strerror_file (GNUNET_ERROR_TYPE_ERROR,
+ "access",
"/dev/net/tun");
fprintf (stderr,
"WARNING: System unable to run test, skipping.\n");
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r37444 - gnunet/src/pt,
gnunet <=