diff options
author | Christian Grothoff <christian@grothoff.org> | 2011-08-15 21:54:06 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2011-08-15 21:54:06 +0000 |
commit | 5746309cb4be2073d550ad7a6885e918631dbc38 (patch) | |
tree | 89455bc4aadf977816b38df13f990372cd81d71a /src/util/test_service.c | |
parent | 6fd3e715cae09fa6e657c96f1c6f9711ee51f42f (diff) | |
download | gnunet-5746309cb4be2073d550ad7a6885e918631dbc38.tar.gz gnunet-5746309cb4be2073d550ad7a6885e918631dbc38.zip |
indentation
Diffstat (limited to 'src/util/test_service.c')
-rw-r--r-- | src/util/test_service.c | 52 |
1 files changed, 19 insertions, 33 deletions
diff --git a/src/util/test_service.c b/src/util/test_service.c index daafa6cd3..4d1608191 100644 --- a/src/util/test_service.c +++ b/src/util/test_service.c | |||
@@ -71,8 +71,8 @@ ready (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
71 | "Client connecting, waiting to transmit\n"); | 71 | "Client connecting, waiting to transmit\n"); |
72 | GNUNET_CLIENT_notify_transmit_ready (client, | 72 | GNUNET_CLIENT_notify_transmit_ready (client, |
73 | sizeof (struct GNUNET_MessageHeader), | 73 | sizeof (struct GNUNET_MessageHeader), |
74 | GNUNET_TIME_UNIT_SECONDS, | 74 | GNUNET_TIME_UNIT_SECONDS, GNUNET_NO, |
75 | GNUNET_NO, &build_msg, client); | 75 | &build_msg, client); |
76 | } | 76 | } |
77 | 77 | ||
78 | static void | 78 | static void |
@@ -83,8 +83,7 @@ do_stop (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
83 | 83 | ||
84 | 84 | ||
85 | static void | 85 | static void |
86 | recv_cb (void *cls, | 86 | recv_cb (void *cls, struct GNUNET_SERVER_Client *client, |
87 | struct GNUNET_SERVER_Client *client, | ||
88 | const struct GNUNET_MessageHeader *message) | 87 | const struct GNUNET_MessageHeader *message) |
89 | { | 88 | { |
90 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Receiving client message...\n"); | 89 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Receiving client message...\n"); |
@@ -105,15 +104,13 @@ static struct GNUNET_SERVER_MessageHandler myhandlers[] = { | |||
105 | 104 | ||
106 | 105 | ||
107 | static void | 106 | static void |
108 | runner (void *cls, | 107 | runner (void *cls, struct GNUNET_SERVER_Handle *server, |
109 | struct GNUNET_SERVER_Handle *server, | ||
110 | const struct GNUNET_CONFIGURATION_Handle *cfg) | 108 | const struct GNUNET_CONFIGURATION_Handle *cfg) |
111 | { | 109 | { |
112 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Service initializing\n"); | 110 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Service initializing\n"); |
113 | GNUNET_SERVER_add_handlers (server, myhandlers); | 111 | GNUNET_SERVER_add_handlers (server, myhandlers); |
114 | GNUNET_CLIENT_service_test ("test_service", | 112 | GNUNET_CLIENT_service_test ("test_service", cfg, GNUNET_TIME_UNIT_SECONDS, |
115 | cfg, GNUNET_TIME_UNIT_SECONDS, &ready, | 113 | &ready, (void *) cfg); |
116 | (void *) cfg); | ||
117 | } | 114 | } |
118 | 115 | ||
119 | 116 | ||
@@ -139,9 +136,7 @@ check () | |||
139 | }; | 136 | }; |
140 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Starting service\n"); | 137 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Starting service\n"); |
141 | GNUNET_assert (GNUNET_OK == | 138 | GNUNET_assert (GNUNET_OK == |
142 | GNUNET_SERVICE_run (5, | 139 | GNUNET_SERVICE_run (5, argv, "test_service", |
143 | argv, | ||
144 | "test_service", | ||
145 | GNUNET_SERVICE_OPTION_NONE, &runner, &ok)); | 140 | GNUNET_SERVICE_OPTION_NONE, &runner, &ok)); |
146 | GNUNET_assert (0 == ok); | 141 | GNUNET_assert (0 == ok); |
147 | return ok; | 142 | return ok; |
@@ -160,20 +155,18 @@ ready6 (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
160 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "V6 client connected\n"); | 155 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "V6 client connected\n"); |
161 | GNUNET_CLIENT_notify_transmit_ready (client, | 156 | GNUNET_CLIENT_notify_transmit_ready (client, |
162 | sizeof (struct GNUNET_MessageHeader), | 157 | sizeof (struct GNUNET_MessageHeader), |
163 | GNUNET_TIME_UNIT_SECONDS, | 158 | GNUNET_TIME_UNIT_SECONDS, GNUNET_NO, |
164 | GNUNET_NO, &build_msg, client); | 159 | &build_msg, client); |
165 | } | 160 | } |
166 | 161 | ||
167 | static void | 162 | static void |
168 | runner6 (void *cls, | 163 | runner6 (void *cls, struct GNUNET_SERVER_Handle *server, |
169 | struct GNUNET_SERVER_Handle *server, | ||
170 | const struct GNUNET_CONFIGURATION_Handle *cfg) | 164 | const struct GNUNET_CONFIGURATION_Handle *cfg) |
171 | { | 165 | { |
172 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Initializing v6 service\n"); | 166 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Initializing v6 service\n"); |
173 | GNUNET_SERVER_add_handlers (server, myhandlers); | 167 | GNUNET_SERVER_add_handlers (server, myhandlers); |
174 | GNUNET_CLIENT_service_test ("test_service6", | 168 | GNUNET_CLIENT_service_test ("test_service6", cfg, GNUNET_TIME_UNIT_SECONDS, |
175 | cfg, GNUNET_TIME_UNIT_SECONDS, &ready6, | 169 | &ready6, (void *) cfg); |
176 | (void *) cfg); | ||
177 | } | 170 | } |
178 | 171 | ||
179 | /** | 172 | /** |
@@ -197,11 +190,9 @@ check6 () | |||
197 | }; | 190 | }; |
198 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Starting v6 service\n"); | 191 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Starting v6 service\n"); |
199 | GNUNET_assert (GNUNET_OK == | 192 | GNUNET_assert (GNUNET_OK == |
200 | GNUNET_SERVICE_run (5, | 193 | GNUNET_SERVICE_run (5, argv, "test_service6", |
201 | argv, | 194 | GNUNET_SERVICE_OPTION_NONE, &runner6, |
202 | "test_service6", | 195 | &ok)); |
203 | GNUNET_SERVICE_OPTION_NONE, | ||
204 | &runner6, &ok)); | ||
205 | GNUNET_assert (0 == ok); | 196 | GNUNET_assert (0 == ok); |
206 | return ok; | 197 | return ok; |
207 | } | 198 | } |
@@ -209,9 +200,7 @@ check6 () | |||
209 | 200 | ||
210 | 201 | ||
211 | static void | 202 | static void |
212 | start_stop_main (void *cls, | 203 | start_stop_main (void *cls, char *const *args, const char *cfgfile, |
213 | char *const *args, | ||
214 | const char *cfgfile, | ||
215 | const struct GNUNET_CONFIGURATION_Handle *cfg) | 204 | const struct GNUNET_CONFIGURATION_Handle *cfg) |
216 | { | 205 | { |
217 | int *ret = cls; | 206 | int *ret = cls; |
@@ -245,10 +234,7 @@ check_start_stop () | |||
245 | int ret = 1; | 234 | int ret = 1; |
246 | 235 | ||
247 | GNUNET_assert (GNUNET_OK == | 236 | GNUNET_assert (GNUNET_OK == |
248 | GNUNET_PROGRAM_run (5, | 237 | GNUNET_PROGRAM_run (5, argv, "test-service-program", "no help", |
249 | argv, | ||
250 | "test-service-program", | ||
251 | "no help", | ||
252 | options, &start_stop_main, &ret)); | 238 | options, &start_stop_main, &ret)); |
253 | 239 | ||
254 | GNUNET_break (0 == ret); | 240 | GNUNET_break (0 == ret); |
@@ -278,8 +264,8 @@ main (int argc, char *argv[]) | |||
278 | #endif | 264 | #endif |
279 | if (NULL == s) | 265 | if (NULL == s) |
280 | { | 266 | { |
281 | if ((errno == ENOBUFS) || | 267 | if ((errno == ENOBUFS) || (errno == ENOMEM) || (errno == ENFILE) || |
282 | (errno == ENOMEM) || (errno == ENFILE) || (errno == EACCES)) | 268 | (errno == EACCES)) |
283 | { | 269 | { |
284 | GNUNET_log_strerror (GNUNET_ERROR_TYPE_ERROR, "socket"); | 270 | GNUNET_log_strerror (GNUNET_ERROR_TYPE_ERROR, "socket"); |
285 | return 1; | 271 | return 1; |