aboutsummaryrefslogtreecommitdiff
path: root/src/template/gnunet-service-template.c
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2009-11-04 14:10:32 +0000
committerChristian Grothoff <christian@grothoff.org>2009-11-04 14:10:32 +0000
commitcf45b8dff29c366d51aa2e6ea6a64b99b514b9c9 (patch)
tree5cb37c041743daff5af528dbbe24f5c563ce702e /src/template/gnunet-service-template.c
parentb91546a3de767292e6472c6b1927480adba43d88 (diff)
downloadgnunet-cf45b8dff29c366d51aa2e6ea6a64b99b514b9c9.tar.gz
gnunet-cf45b8dff29c366d51aa2e6ea6a64b99b514b9c9.zip
bugfixes and redesigning scheduler API
Diffstat (limited to 'src/template/gnunet-service-template.c')
-rw-r--r--src/template/gnunet-service-template.c34
1 files changed, 20 insertions, 14 deletions
diff --git a/src/template/gnunet-service-template.c b/src/template/gnunet-service-template.c
index 3ab7d3dcc..15ba94b7d 100644
--- a/src/template/gnunet-service-template.c
+++ b/src/template/gnunet-service-template.c
@@ -27,19 +27,6 @@
27#include "gnunet_getopt_lib.h" 27#include "gnunet_getopt_lib.h"
28#include "gnunet_service_lib.h" 28#include "gnunet_service_lib.h"
29 29
30/**
31 * Do cleanup here.
32 *
33 * @param cls closure
34 * @param cfg configuration to use
35 */
36static void
37finish (void *cls,
38 const struct GNUNET_CONFIGURATION_Handle *cfg)
39{
40 /* FIXME */
41}
42
43 30
44/** 31/**
45 * List of handlers for the messages understood by this 32 * List of handlers for the messages understood by this
@@ -50,6 +37,21 @@ static struct GNUNET_SERVER_MessageHandler handlers[] = {
50 {NULL, NULL, 0, 0} 37 {NULL, NULL, 0, 0}
51}; 38};
52 39
40
41/**
42 * Task run during shutdown.
43 *
44 * @param cls unused
45 * @param tc unused
46 */
47static void
48cleanup_task (void *cls,
49 const struct GNUNET_SCHEDULER_TaskContext *tc)
50{
51 /* FIXME: do clean up here */
52}
53
54
53/** 55/**
54 * Process template requests. 56 * Process template requests.
55 * 57 *
@@ -66,6 +68,10 @@ run (void *cls,
66{ 68{
67 /* FIXME: do setup here */ 69 /* FIXME: do setup here */
68 GNUNET_SERVER_add_handlers (server, handlers); 70 GNUNET_SERVER_add_handlers (server, handlers);
71 GNUNET_SCHEDULER_add_delayed (sched,
72 GNUNET_TIME_UNIT_FOREVER_REL,
73 &cleanup_task,
74 NULL);
69} 75}
70 76
71 77
@@ -82,7 +88,7 @@ main (int argc, char *const *argv)
82 return (GNUNET_OK == 88 return (GNUNET_OK ==
83 GNUNET_SERVICE_run (argc, 89 GNUNET_SERVICE_run (argc,
84 argv, 90 argv,
85 "template", &run, NULL, &finish, NULL)) ? 0 : 1; 91 "template", &run, NULL)) ? 0 : 1;
86} 92}
87 93
88/* end of gnunet-service-template.c */ 94/* end of gnunet-service-template.c */