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.c75
1 files changed, 39 insertions, 36 deletions
diff --git a/src/arm/mockup-service.c b/src/arm/mockup-service.c
index 667556314..6134f17b3 100644
--- a/src/arm/mockup-service.c
+++ b/src/arm/mockup-service.c
@@ -11,12 +11,12 @@
11 WITHOUT ANY WARRANTY; without even the implied warranty of 11 WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Affero General Public License for more details. 13 Affero General Public License for more details.
14 14
15 You should have received a copy of the GNU Affero General Public License 15 You should have received a copy of the GNU Affero General Public License
16 along with this program. If not, see <http://www.gnu.org/licenses/>. 16 along with this program. If not, see <http://www.gnu.org/licenses/>.
17 17
18 SPDX-License-Identifier: AGPL3.0-or-later 18 SPDX-License-Identifier: AGPL3.0-or-later
19*/ 19 */
20 20
21#include <stdlib.h> 21#include <stdlib.h>
22#include "platform.h" 22#include "platform.h"
@@ -33,15 +33,15 @@ 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, const struct GNUNET_MessageHeader *message) 36handle_stop(void *cls, const struct GNUNET_MessageHeader *message)
37{ 37{
38 struct GNUNET_SERVICE_Client *client = cls; 38 struct GNUNET_SERVICE_Client *client = cls;
39 39
40 (void) message; 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
46 * terminate normally. This changes the return code. 46 * terminate normally. This changes the return code.
47 */ 47 */
@@ -58,12 +58,12 @@ handle_stop (void *cls, const struct GNUNET_MessageHeader *message)
58 * @return @a c 58 * @return @a c
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; 65 (void)cls;
66 (void) mq; 66 (void)mq;
67 return c; 67 return c;
68} 68}
69 69
@@ -76,23 +76,23 @@ client_connect_cb (void *cls,
76 * @param internal_cls should be equal to @a c 76 * @param internal_cls should be equal to @a c
77 */ 77 */
78static void 78static void
79client_disconnect_cb (void *cls, 79client_disconnect_cb(void *cls,
80 struct GNUNET_SERVICE_Client *c, 80 struct GNUNET_SERVICE_Client *c,
81 void *internal_cls) 81 void *internal_cls)
82{ 82{
83 (void) cls; 83 (void)cls;
84 GNUNET_assert (c == internal_cls); 84 GNUNET_assert(c == internal_cls);
85} 85}
86 86
87 87
88static void 88static void
89run (void *cls, 89run(void *cls,
90 const struct GNUNET_CONFIGURATION_Handle *cfg, 90 const struct GNUNET_CONFIGURATION_Handle *cfg,
91 struct GNUNET_SERVICE_Handle *service) 91 struct GNUNET_SERVICE_Handle *service)
92{ 92{
93 (void) cls; 93 (void)cls;
94 (void) cfg; 94 (void)cfg;
95 (void) service; 95 (void)service;
96 /* nothing to do */ 96 /* nothing to do */
97} 97}
98 98
@@ -100,20 +100,23 @@ run (void *cls,
100/** 100/**
101 * Define "main" method using service macro. 101 * Define "main" method using service macro.
102 */ 102 */
103GNUNET_SERVICE_MAIN ("do-nothing", 103GNUNET_SERVICE_MAIN("do-nothing",
104 GNUNET_SERVICE_OPTION_NONE, 104 GNUNET_SERVICE_OPTION_NONE,
105 &run, 105 &run,
106 &client_connect_cb, 106 &client_connect_cb,
107 &client_disconnect_cb, 107 &client_disconnect_cb,
108 NULL, 108 NULL,
109 GNUNET_MQ_hd_fixed_size (stop, 109 GNUNET_MQ_hd_fixed_size(stop,
110 GNUNET_MESSAGE_TYPE_ARM_STOP, 110 GNUNET_MESSAGE_TYPE_ARM_STOP,
111 struct GNUNET_MessageHeader, 111 struct GNUNET_MessageHeader,
112 NULL), 112 NULL),
113 GNUNET_MQ_handler_end ()); 113 GNUNET_MQ_handler_end());
114 114
115 115
116/** 116/**
117 * 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.
118 */ 118 */
119void __attribute__ ((destructor)) GNUNET_mockup_done () { _exit (special_ret); } 119void __attribute__ ((destructor)) GNUNET_mockup_done()
120{
121 _exit(special_ret);
122}