[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] [gnunet] branch master updated: implement -T option for gnu
From: |
gnunet |
Subject: |
[GNUnet-SVN] [gnunet] branch master updated: implement -T option for gnunet-arm (#4854) |
Date: |
Fri, 13 Jan 2017 13:23:40 +0100 |
This is an automated email from the git hooks/post-receive script.
grothoff pushed a commit to branch master
in repository gnunet.
The following commit(s) were added to refs/heads/master by this push:
new 553da9baa implement -T option for gnunet-arm (#4854)
553da9baa is described below
commit 553da9baaee28de37ac70af6e59549cabdd18373
Author: Christian Grothoff <address@hidden>
AuthorDate: Fri Jan 13 13:23:38 2017 +0100
implement -T option for gnunet-arm (#4854)
---
src/arm/gnunet-arm.c | 37 +++++++++++++++++++++++++++++++------
1 file changed, 31 insertions(+), 6 deletions(-)
diff --git a/src/arm/gnunet-arm.c b/src/arm/gnunet-arm.c
index 3b024ea93..b6f4d99a8 100644
--- a/src/arm/gnunet-arm.c
+++ b/src/arm/gnunet-arm.c
@@ -110,11 +110,15 @@ static unsigned int phase;
/**
* User defined timestamp for completing operations.
- * FIXME: to be implemented!
*/
static struct GNUNET_TIME_Relative timeout;
/**
+ * Task to be run on timeout.
+ */
+static struct GNUNET_SCHEDULER_Task *timeout_task;
+
+/**
* Do we want to give our stdout to gnunet-service-arm?
*/
static unsigned int no_stdout;
@@ -191,6 +195,11 @@ shutdown_task (void *cls)
GNUNET_ARM_monitor_stop (m);
m = NULL;
}
+ if (NULL != timeout_task)
+ {
+ GNUNET_SCHEDULER_cancel (timeout_task);
+ timeout_task = NULL;
+ }
if ((GNUNET_YES == end) && (GNUNET_YES == delete))
delete_files ();
GNUNET_CONFIGURATION_destroy (cfg);
@@ -683,6 +692,18 @@ srv_status (void *cls,
/**
+ * Task run on timeout (if -T is given).
+ */
+static void
+timeout_task_cb (void *cls)
+{
+ timeout_task = NULL;
+ ret = 2;
+ GNUNET_SCHEDULER_shutdown ();
+}
+
+
+/**
* Main function that will be run by the scheduler.
*
* @param cls closure
@@ -739,6 +760,10 @@ run (void *cls,
NULL);
GNUNET_SCHEDULER_add_shutdown (&shutdown_task,
NULL);
+ if (0 != timeout.rel_value_us)
+ timeout_task = GNUNET_SCHEDULER_add_delayed (timeout,
+ &timeout_task_cb,
+ NULL);
}
@@ -747,7 +772,7 @@ run (void *cls,
*
* @param argc number of arguments from the command line
* @param argv command line arguments
- * @return 0 ok, 1 on error
+ * @return 0 ok, 1 on error, 2 on timeout
*/
int
main (int argc, char *const *argv)
@@ -793,10 +818,10 @@ main (int argc, char *const *argv)
gettext_noop
("Control services and the Automated Restart Manager
(ARM)"),
options, &run, NULL))
- {
- GNUNET_free ((void *) argv);
- return ret;
- }
+ {
+ GNUNET_free ((void *) argv);
+ return ret;
+ }
GNUNET_free ((void*) argv);
return 1;
}
--
To stop receiving notification emails like this one, please contact
address@hidden
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] [gnunet] branch master updated: implement -T option for gnunet-arm (#4854),
gnunet <=