aboutsummaryrefslogtreecommitdiff
path: root/src/arm/mockup-service.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/arm/mockup-service.c')
-rw-r--r--src/arm/mockup-service.c49
1 files changed, 25 insertions, 24 deletions
diff --git a/src/arm/mockup-service.c b/src/arm/mockup-service.c
index c9f00b5dd..667556314 100644
--- a/src/arm/mockup-service.c
+++ b/src/arm/mockup-service.c
@@ -33,13 +33,13 @@ static int special_ret = 0;
33 * @param message the actual message 33 * @param message the actual message
34 */ 34 */
35static void 35static void
36handle_stop (void *cls, 36handle_stop (void *cls, const struct GNUNET_MessageHeader *message)
37 const struct GNUNET_MessageHeader *message)
38{ 37{
39 struct GNUNET_SERVICE_Client *client = cls; 38 struct GNUNET_SERVICE_Client *client = cls;
40 39
40 (void) message;
41 GNUNET_log (GNUNET_ERROR_TYPE_INFO, 41 GNUNET_log (GNUNET_ERROR_TYPE_INFO,
42 _("Initiating shutdown as requested by client.\n")); 42 _ ("Initiating shutdown as requested by client.\n"));
43 GNUNET_SERVICE_client_persist (client); 43 GNUNET_SERVICE_client_persist (client);
44 GNUNET_SCHEDULER_shutdown (); 44 GNUNET_SCHEDULER_shutdown ();
45 /* ARM won't exponentially increase restart delay if we 45 /* ARM won't exponentially increase restart delay if we
@@ -59,9 +59,11 @@ handle_stop (void *cls,
59 */ 59 */
60static void * 60static void *
61client_connect_cb (void *cls, 61client_connect_cb (void *cls,
62 struct GNUNET_SERVICE_Client *c, 62 struct GNUNET_SERVICE_Client *c,
63 struct GNUNET_MQ_Handle *mq) 63 struct GNUNET_MQ_Handle *mq)
64{ 64{
65 (void) cls;
66 (void) mq;
65 return c; 67 return c;
66} 68}
67 69
@@ -75,9 +77,10 @@ client_connect_cb (void *cls,
75 */ 77 */
76static void 78static void
77client_disconnect_cb (void *cls, 79client_disconnect_cb (void *cls,
78 struct GNUNET_SERVICE_Client *c, 80 struct GNUNET_SERVICE_Client *c,
79 void *internal_cls) 81 void *internal_cls)
80{ 82{
83 (void) cls;
81 GNUNET_assert (c == internal_cls); 84 GNUNET_assert (c == internal_cls);
82} 85}
83 86
@@ -87,6 +90,9 @@ run (void *cls,
87 const struct GNUNET_CONFIGURATION_Handle *cfg, 90 const struct GNUNET_CONFIGURATION_Handle *cfg,
88 struct GNUNET_SERVICE_Handle *service) 91 struct GNUNET_SERVICE_Handle *service)
89{ 92{
93 (void) cls;
94 (void) cfg;
95 (void) service;
90 /* nothing to do */ 96 /* nothing to do */
91} 97}
92 98
@@ -94,25 +100,20 @@ run (void *cls,
94/** 100/**
95 * Define "main" method using service macro. 101 * Define "main" method using service macro.
96 */ 102 */
97GNUNET_SERVICE_MAIN 103GNUNET_SERVICE_MAIN ("do-nothing",
98("do-nothing", 104 GNUNET_SERVICE_OPTION_NONE,
99 GNUNET_SERVICE_OPTION_NONE, 105 &run,
100 &run, 106 &client_connect_cb,
101 &client_connect_cb, 107 &client_disconnect_cb,
102 &client_disconnect_cb, 108 NULL,
103 NULL, 109 GNUNET_MQ_hd_fixed_size (stop,
104 GNUNET_MQ_hd_fixed_size (stop, 110 GNUNET_MESSAGE_TYPE_ARM_STOP,
105 GNUNET_MESSAGE_TYPE_ARM_STOP, 111 struct GNUNET_MessageHeader,
106 struct GNUNET_MessageHeader, 112 NULL),
107 NULL), 113 GNUNET_MQ_handler_end ());
108 GNUNET_MQ_handler_end ());
109 114
110 115
111/** 116/**
112 * MINIMIZE heap size (way below 128k) since this process doesn't need much. 117 * MINIMIZE heap size (way below 128k) since this process doesn't need much.
113 */ 118 */
114void __attribute__ ((destructor)) 119void __attribute__ ((destructor)) GNUNET_mockup_done () { _exit (special_ret); }
115GNUNET_mockup_done ()
116{
117 _exit (special_ret);
118}