diff options
Diffstat (limited to 'src/ats/gnunet-service-ats.c')
-rw-r--r-- | src/ats/gnunet-service-ats.c | 447 |
1 files changed, 224 insertions, 223 deletions
diff --git a/src/ats/gnunet-service-ats.c b/src/ats/gnunet-service-ats.c index d9bb71c2b..fbef6f166 100644 --- a/src/ats/gnunet-service-ats.c +++ b/src/ats/gnunet-service-ats.c | |||
@@ -50,47 +50,47 @@ struct GNUNET_STATISTICS_Handle *GSA_stats; | |||
50 | * @param msg the start message | 50 | * @param msg the start message |
51 | */ | 51 | */ |
52 | static void | 52 | static void |
53 | handle_ats_start(void *cls, | 53 | handle_ats_start (void *cls, |
54 | const struct ClientStartMessage *msg) | 54 | const struct ClientStartMessage *msg) |
55 | { | 55 | { |
56 | struct GNUNET_SERVICE_Client *client = cls; | 56 | struct GNUNET_SERVICE_Client *client = cls; |
57 | enum StartFlag flag; | 57 | enum StartFlag flag; |
58 | 58 | ||
59 | flag = ntohl(msg->start_flag); | 59 | flag = ntohl (msg->start_flag); |
60 | GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, | 60 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
61 | "Received ATS_START (%d) message\n", | 61 | "Received ATS_START (%d) message\n", |
62 | (int)flag); | 62 | (int) flag); |
63 | switch (flag) | 63 | switch (flag) |
64 | { | ||
65 | case START_FLAG_SCHEDULING: | ||
66 | if (GNUNET_OK != | ||
67 | GAS_scheduling_add_client (client)) | ||
64 | { | 68 | { |
65 | case START_FLAG_SCHEDULING: | 69 | GNUNET_SERVICE_client_drop (client); |
66 | if (GNUNET_OK != | ||
67 | GAS_scheduling_add_client(client)) | ||
68 | { | ||
69 | GNUNET_SERVICE_client_drop(client); | ||
70 | return; | ||
71 | } | ||
72 | break; | ||
73 | |||
74 | case START_FLAG_PERFORMANCE_WITH_PIC: | ||
75 | GAS_performance_add_client(client, | ||
76 | flag); | ||
77 | break; | ||
78 | |||
79 | case START_FLAG_PERFORMANCE_NO_PIC: | ||
80 | GAS_performance_add_client(client, | ||
81 | flag); | ||
82 | break; | ||
83 | |||
84 | case START_FLAG_CONNECTION_SUGGESTION: | ||
85 | /* This client won't receive messages from us, no need to 'add' */ | ||
86 | break; | ||
87 | |||
88 | default: | ||
89 | GNUNET_break(0); | ||
90 | GNUNET_SERVICE_client_drop(client); | ||
91 | return; | 70 | return; |
92 | } | 71 | } |
93 | GNUNET_SERVICE_client_continue(client); | 72 | break; |
73 | |||
74 | case START_FLAG_PERFORMANCE_WITH_PIC: | ||
75 | GAS_performance_add_client (client, | ||
76 | flag); | ||
77 | break; | ||
78 | |||
79 | case START_FLAG_PERFORMANCE_NO_PIC: | ||
80 | GAS_performance_add_client (client, | ||
81 | flag); | ||
82 | break; | ||
83 | |||
84 | case START_FLAG_CONNECTION_SUGGESTION: | ||
85 | /* This client won't receive messages from us, no need to 'add' */ | ||
86 | break; | ||
87 | |||
88 | default: | ||
89 | GNUNET_break (0); | ||
90 | GNUNET_SERVICE_client_drop (client); | ||
91 | return; | ||
92 | } | ||
93 | GNUNET_SERVICE_client_continue (client); | ||
94 | } | 94 | } |
95 | 95 | ||
96 | 96 | ||
@@ -102,14 +102,14 @@ handle_ats_start(void *cls, | |||
102 | * @param message the request message | 102 | * @param message the request message |
103 | */ | 103 | */ |
104 | static void | 104 | static void |
105 | handle_reservation_request(void *cls, | 105 | handle_reservation_request (void *cls, |
106 | const struct ReservationRequestMessage *message) | 106 | const struct ReservationRequestMessage *message) |
107 | { | 107 | { |
108 | struct GNUNET_SERVICE_Client *client = cls; | 108 | struct GNUNET_SERVICE_Client *client = cls; |
109 | 109 | ||
110 | GAS_handle_reservation_request(client, | 110 | GAS_handle_reservation_request (client, |
111 | message); | 111 | message); |
112 | GNUNET_SERVICE_client_continue(client); | 112 | GNUNET_SERVICE_client_continue (client); |
113 | } | 113 | } |
114 | 114 | ||
115 | 115 | ||
@@ -121,23 +121,23 @@ handle_reservation_request(void *cls, | |||
121 | * @return #GNUNET_OK if @a message is well-formed | 121 | * @return #GNUNET_OK if @a message is well-formed |
122 | */ | 122 | */ |
123 | static int | 123 | static int |
124 | check_feedback(void *cls, | 124 | check_feedback (void *cls, |
125 | const struct FeedbackPreferenceMessage *message) | 125 | const struct FeedbackPreferenceMessage *message) |
126 | { | 126 | { |
127 | uint16_t msize; | 127 | uint16_t msize; |
128 | uint32_t nump; | 128 | uint32_t nump; |
129 | 129 | ||
130 | GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, | 130 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
131 | "Received PREFERENCE_FEEDBACK message\n"); | 131 | "Received PREFERENCE_FEEDBACK message\n"); |
132 | msize = ntohs(message->header.size); | 132 | msize = ntohs (message->header.size); |
133 | nump = ntohl(message->num_feedback); | 133 | nump = ntohl (message->num_feedback); |
134 | if (msize != | 134 | if (msize != |
135 | sizeof(struct FeedbackPreferenceMessage) + | 135 | sizeof(struct FeedbackPreferenceMessage) |
136 | nump * sizeof(struct PreferenceInformation)) | 136 | + nump * sizeof(struct PreferenceInformation)) |
137 | { | 137 | { |
138 | GNUNET_break(0); | 138 | GNUNET_break (0); |
139 | return GNUNET_SYSERR; | 139 | return GNUNET_SYSERR; |
140 | } | 140 | } |
141 | return GNUNET_OK; | 141 | return GNUNET_OK; |
142 | } | 142 | } |
143 | 143 | ||
@@ -149,42 +149,43 @@ check_feedback(void *cls, | |||
149 | * @param msg the request message | 149 | * @param msg the request message |
150 | */ | 150 | */ |
151 | static void | 151 | static void |
152 | handle_feedback(void *cls, | 152 | handle_feedback (void *cls, |
153 | const struct FeedbackPreferenceMessage *msg) | 153 | const struct FeedbackPreferenceMessage *msg) |
154 | { | 154 | { |
155 | struct GNUNET_SERVICE_Client *client = cls; | 155 | struct GNUNET_SERVICE_Client *client = cls; |
156 | const struct PreferenceInformation *pi; | 156 | const struct PreferenceInformation *pi; |
157 | uint32_t nump; | 157 | uint32_t nump; |
158 | 158 | ||
159 | nump = ntohl(msg->num_feedback); | 159 | nump = ntohl (msg->num_feedback); |
160 | if (GNUNET_NO == | 160 | if (GNUNET_NO == |
161 | GNUNET_CONTAINER_multipeermap_contains(GSA_addresses, | 161 | GNUNET_CONTAINER_multipeermap_contains (GSA_addresses, |
162 | &msg->peer)) | 162 | &msg->peer)) |
163 | { | 163 | { |
164 | GNUNET_log(GNUNET_ERROR_TYPE_WARNING, | 164 | GNUNET_log (GNUNET_ERROR_TYPE_WARNING, |
165 | "Received PREFERENCE FEEDBACK for unknown peer `%s'\n", | 165 | "Received PREFERENCE FEEDBACK for unknown peer `%s'\n", |
166 | GNUNET_i2s(&msg->peer)); | 166 | GNUNET_i2s (&msg->peer)); |
167 | GNUNET_SERVICE_client_continue(client); | 167 | GNUNET_SERVICE_client_continue (client); |
168 | return; | 168 | return; |
169 | } | 169 | } |
170 | 170 | ||
171 | GNUNET_STATISTICS_update(GSA_stats, | 171 | GNUNET_STATISTICS_update (GSA_stats, |
172 | "# preference feedbacks requests processed", | 172 | "# preference feedbacks requests processed", |
173 | 1, | 173 | 1, |
174 | GNUNET_NO); | 174 | GNUNET_NO); |
175 | pi = (const struct PreferenceInformation *)&msg[1]; | 175 | pi = (const struct PreferenceInformation *) &msg[1]; |
176 | for (uint32_t i = 0; i < nump; i++) | 176 | for (uint32_t i = 0; i < nump; i++) |
177 | { | 177 | { |
178 | GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, | 178 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
179 | "Received PREFERENCE FEEDBACK for peer `%s'\n", | 179 | "Received PREFERENCE FEEDBACK for peer `%s'\n", |
180 | GNUNET_i2s(&msg->peer)); | 180 | GNUNET_i2s (&msg->peer)); |
181 | GAS_plugin_notify_feedback(client, | 181 | GAS_plugin_notify_feedback (client, |
182 | &msg->peer, | 182 | &msg->peer, |
183 | GNUNET_TIME_relative_ntoh(msg->scope), | 183 | GNUNET_TIME_relative_ntoh (msg->scope), |
184 | (enum GNUNET_ATS_PreferenceKind)ntohl(pi[i].preference_kind), | 184 | (enum GNUNET_ATS_PreferenceKind) ntohl ( |
185 | pi[i].preference_value); | 185 | pi[i].preference_kind), |
186 | } | 186 | pi[i].preference_value); |
187 | GNUNET_SERVICE_client_continue(client); | 187 | } |
188 | GNUNET_SERVICE_client_continue (client); | ||
188 | } | 189 | } |
189 | 190 | ||
190 | 191 | ||
@@ -195,14 +196,14 @@ handle_feedback(void *cls, | |||
195 | * @param message the request message | 196 | * @param message the request message |
196 | */ | 197 | */ |
197 | static void | 198 | static void |
198 | handle_request_address_list(void *cls, | 199 | handle_request_address_list (void *cls, |
199 | const struct AddressListRequestMessage *message) | 200 | const struct AddressListRequestMessage *message) |
200 | { | 201 | { |
201 | struct GNUNET_SERVICE_Client *client = cls; | 202 | struct GNUNET_SERVICE_Client *client = cls; |
202 | 203 | ||
203 | GAS_handle_request_address_list(client, | 204 | GAS_handle_request_address_list (client, |
204 | message); | 205 | message); |
205 | GNUNET_SERVICE_client_continue(client); | 206 | GNUNET_SERVICE_client_continue (client); |
206 | } | 207 | } |
207 | 208 | ||
208 | 209 | ||
@@ -213,14 +214,14 @@ handle_request_address_list(void *cls, | |||
213 | * @param message the request message | 214 | * @param message the request message |
214 | */ | 215 | */ |
215 | static void | 216 | static void |
216 | handle_request_address(void *cls, | 217 | handle_request_address (void *cls, |
217 | const struct RequestAddressMessage * message) | 218 | const struct RequestAddressMessage *message) |
218 | { | 219 | { |
219 | struct GNUNET_SERVICE_Client *client = cls; | 220 | struct GNUNET_SERVICE_Client *client = cls; |
220 | 221 | ||
221 | GAS_handle_request_address(client, | 222 | GAS_handle_request_address (client, |
222 | message); | 223 | message); |
223 | GNUNET_SERVICE_client_continue(client); | 224 | GNUNET_SERVICE_client_continue (client); |
224 | } | 225 | } |
225 | 226 | ||
226 | 227 | ||
@@ -231,14 +232,14 @@ handle_request_address(void *cls, | |||
231 | * @param message the request message | 232 | * @param message the request message |
232 | */ | 233 | */ |
233 | static void | 234 | static void |
234 | handle_request_address_cancel(void *cls, | 235 | handle_request_address_cancel (void *cls, |
235 | const struct RequestAddressMessage *message) | 236 | const struct RequestAddressMessage *message) |
236 | { | 237 | { |
237 | struct GNUNET_SERVICE_Client *client = cls; | 238 | struct GNUNET_SERVICE_Client *client = cls; |
238 | 239 | ||
239 | GAS_handle_request_address_cancel(client, | 240 | GAS_handle_request_address_cancel (client, |
240 | message); | 241 | message); |
241 | GNUNET_SERVICE_client_continue(client); | 242 | GNUNET_SERVICE_client_continue (client); |
242 | } | 243 | } |
243 | 244 | ||
244 | 245 | ||
@@ -249,8 +250,8 @@ handle_request_address_cancel(void *cls, | |||
249 | * @param m the request message | 250 | * @param m the request message |
250 | */ | 251 | */ |
251 | static int | 252 | static int |
252 | check_address_add(void *cls, | 253 | check_address_add (void *cls, |
253 | const struct AddressAddMessage *m) | 254 | const struct AddressAddMessage *m) |
254 | { | 255 | { |
255 | const char *address; | 256 | const char *address; |
256 | const char *plugin_name; | 257 | const char *plugin_name; |
@@ -258,23 +259,23 @@ check_address_add(void *cls, | |||
258 | uint16_t plugin_name_length; | 259 | uint16_t plugin_name_length; |
259 | uint16_t size; | 260 | uint16_t size; |
260 | 261 | ||
261 | size = ntohs(m->header.size); | 262 | size = ntohs (m->header.size); |
262 | address_length = ntohs(m->address_length); | 263 | address_length = ntohs (m->address_length); |
263 | plugin_name_length = ntohs(m->plugin_name_length); | 264 | plugin_name_length = ntohs (m->plugin_name_length); |
264 | address = (const char *)&m[1]; | 265 | address = (const char *) &m[1]; |
265 | if (plugin_name_length != 0) | 266 | if (plugin_name_length != 0) |
266 | plugin_name = &address[address_length]; | 267 | plugin_name = &address[address_length]; |
267 | else | 268 | else |
268 | plugin_name = ""; | 269 | plugin_name = ""; |
269 | 270 | ||
270 | if ((address_length + plugin_name_length + | 271 | if ((address_length + plugin_name_length |
271 | sizeof(struct AddressAddMessage) != size) || | 272 | + sizeof(struct AddressAddMessage) != size) || |
272 | ((plugin_name_length > 0) && | 273 | ((plugin_name_length > 0) && |
273 | (plugin_name[plugin_name_length - 1] != '\0'))) | 274 | (plugin_name[plugin_name_length - 1] != '\0'))) |
274 | { | 275 | { |
275 | GNUNET_break(0); | 276 | GNUNET_break (0); |
276 | return GNUNET_SYSERR; | 277 | return GNUNET_SYSERR; |
277 | } | 278 | } |
278 | return GNUNET_OK; | 279 | return GNUNET_OK; |
279 | } | 280 | } |
280 | 281 | ||
@@ -286,13 +287,13 @@ check_address_add(void *cls, | |||
286 | * @param message the request message | 287 | * @param message the request message |
287 | */ | 288 | */ |
288 | static void | 289 | static void |
289 | handle_address_add(void *cls, | 290 | handle_address_add (void *cls, |
290 | const struct AddressAddMessage *message) | 291 | const struct AddressAddMessage *message) |
291 | { | 292 | { |
292 | struct GNUNET_SERVICE_Client *client = cls; | 293 | struct GNUNET_SERVICE_Client *client = cls; |
293 | 294 | ||
294 | GAS_handle_address_add(message); | 295 | GAS_handle_address_add (message); |
295 | GNUNET_SERVICE_client_continue(client); | 296 | GNUNET_SERVICE_client_continue (client); |
296 | } | 297 | } |
297 | 298 | ||
298 | 299 | ||
@@ -303,13 +304,13 @@ handle_address_add(void *cls, | |||
303 | * @param message the request message | 304 | * @param message the request message |
304 | */ | 305 | */ |
305 | static void | 306 | static void |
306 | handle_address_update(void *cls, | 307 | handle_address_update (void *cls, |
307 | const struct AddressUpdateMessage *message) | 308 | const struct AddressUpdateMessage *message) |
308 | { | 309 | { |
309 | struct GNUNET_SERVICE_Client *client = cls; | 310 | struct GNUNET_SERVICE_Client *client = cls; |
310 | 311 | ||
311 | GAS_handle_address_update(message); | 312 | GAS_handle_address_update (message); |
312 | GNUNET_SERVICE_client_continue(client); | 313 | GNUNET_SERVICE_client_continue (client); |
313 | } | 314 | } |
314 | 315 | ||
315 | 316 | ||
@@ -320,13 +321,13 @@ handle_address_update(void *cls, | |||
320 | * @param message the request message | 321 | * @param message the request message |
321 | */ | 322 | */ |
322 | static void | 323 | static void |
323 | handle_address_destroyed(void *cls, | 324 | handle_address_destroyed (void *cls, |
324 | const struct AddressDestroyedMessage *message) | 325 | const struct AddressDestroyedMessage *message) |
325 | { | 326 | { |
326 | struct GNUNET_SERVICE_Client *client = cls; | 327 | struct GNUNET_SERVICE_Client *client = cls; |
327 | 328 | ||
328 | GAS_handle_address_destroyed(message); | 329 | GAS_handle_address_destroyed (message); |
329 | GNUNET_SERVICE_client_continue(client); | 330 | GNUNET_SERVICE_client_continue (client); |
330 | } | 331 | } |
331 | 332 | ||
332 | 333 | ||
@@ -338,22 +339,22 @@ handle_address_destroyed(void *cls, | |||
338 | * @return #GNUNET_OK if @a message is well-formed | 339 | * @return #GNUNET_OK if @a message is well-formed |
339 | */ | 340 | */ |
340 | static int | 341 | static int |
341 | check_preference_change(void *cls, | 342 | check_preference_change (void *cls, |
342 | const struct ChangePreferenceMessage *message) | 343 | const struct ChangePreferenceMessage *message) |
343 | { | 344 | { |
344 | uint16_t msize; | 345 | uint16_t msize; |
345 | uint32_t nump; | 346 | uint32_t nump; |
346 | 347 | ||
347 | msize = ntohs(message->header.size); | 348 | msize = ntohs (message->header.size); |
348 | nump = ntohl(message->num_preferences); | 349 | nump = ntohl (message->num_preferences); |
349 | if ((msize != | 350 | if ((msize != |
350 | sizeof(struct ChangePreferenceMessage) + | 351 | sizeof(struct ChangePreferenceMessage) |
351 | nump * sizeof(struct PreferenceInformation)) || | 352 | + nump * sizeof(struct PreferenceInformation)) || |
352 | (UINT16_MAX / sizeof(struct PreferenceInformation) < nump)) | 353 | (UINT16_MAX / sizeof(struct PreferenceInformation) < nump)) |
353 | { | 354 | { |
354 | GNUNET_break(0); | 355 | GNUNET_break (0); |
355 | return GNUNET_SYSERR; | 356 | return GNUNET_SYSERR; |
356 | } | 357 | } |
357 | return GNUNET_OK; | 358 | return GNUNET_OK; |
358 | } | 359 | } |
359 | 360 | ||
@@ -365,14 +366,14 @@ check_preference_change(void *cls, | |||
365 | * @param message the request message | 366 | * @param message the request message |
366 | */ | 367 | */ |
367 | static void | 368 | static void |
368 | handle_preference_change(void *cls, | 369 | handle_preference_change (void *cls, |
369 | const struct ChangePreferenceMessage *message) | 370 | const struct ChangePreferenceMessage *message) |
370 | { | 371 | { |
371 | struct GNUNET_SERVICE_Client *client = cls; | 372 | struct GNUNET_SERVICE_Client *client = cls; |
372 | 373 | ||
373 | GAS_handle_preference_change(client, | 374 | GAS_handle_preference_change (client, |
374 | message); | 375 | message); |
375 | GNUNET_SERVICE_client_continue(client); | 376 | GNUNET_SERVICE_client_continue (client); |
376 | } | 377 | } |
377 | 378 | ||
378 | 379 | ||
@@ -386,9 +387,9 @@ handle_preference_change(void *cls, | |||
386 | * @return @a client | 387 | * @return @a client |
387 | */ | 388 | */ |
388 | static void * | 389 | static void * |
389 | client_connect_cb(void *cls, | 390 | client_connect_cb (void *cls, |
390 | struct GNUNET_SERVICE_Client *client, | 391 | struct GNUNET_SERVICE_Client *client, |
391 | struct GNUNET_MQ_Handle *mq) | 392 | struct GNUNET_MQ_Handle *mq) |
392 | { | 393 | { |
393 | return client; | 394 | return client; |
394 | } | 395 | } |
@@ -403,15 +404,15 @@ client_connect_cb(void *cls, | |||
403 | * @param app_ctx | 404 | * @param app_ctx |
404 | */ | 405 | */ |
405 | static void | 406 | static void |
406 | client_disconnect_cb(void *cls, | 407 | client_disconnect_cb (void *cls, |
407 | struct GNUNET_SERVICE_Client *client, | 408 | struct GNUNET_SERVICE_Client *client, |
408 | void *app_ctx) | 409 | void *app_ctx) |
409 | { | 410 | { |
410 | if (NULL == client) | 411 | if (NULL == client) |
411 | return; | 412 | return; |
412 | GAS_scheduling_remove_client(client); | 413 | GAS_scheduling_remove_client (client); |
413 | GAS_connectivity_remove_client(client); | 414 | GAS_connectivity_remove_client (client); |
414 | GAS_preference_client_disconnect(client); | 415 | GAS_preference_client_disconnect (client); |
415 | } | 416 | } |
416 | 417 | ||
417 | 418 | ||
@@ -421,22 +422,22 @@ client_disconnect_cb(void *cls, | |||
421 | * @param cls unused | 422 | * @param cls unused |
422 | */ | 423 | */ |
423 | static void | 424 | static void |
424 | cleanup_task(void *cls) | 425 | cleanup_task (void *cls) |
425 | { | 426 | { |
426 | GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, | 427 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
427 | "ATS shutdown initiated\n"); | 428 | "ATS shutdown initiated\n"); |
428 | GAS_connectivity_done(); | 429 | GAS_connectivity_done (); |
429 | GAS_addresses_done(); | 430 | GAS_addresses_done (); |
430 | GAS_plugin_done(); | 431 | GAS_plugin_done (); |
431 | GAS_normalization_stop(); | 432 | GAS_normalization_stop (); |
432 | GAS_performance_done(); | 433 | GAS_performance_done (); |
433 | GAS_preference_done(); | 434 | GAS_preference_done (); |
434 | GAS_reservations_done(); | 435 | GAS_reservations_done (); |
435 | if (NULL != GSA_stats) | 436 | if (NULL != GSA_stats) |
436 | { | 437 | { |
437 | GNUNET_STATISTICS_destroy(GSA_stats, GNUNET_NO); | 438 | GNUNET_STATISTICS_destroy (GSA_stats, GNUNET_NO); |
438 | GSA_stats = NULL; | 439 | GSA_stats = NULL; |
439 | } | 440 | } |
440 | } | 441 | } |
441 | 442 | ||
442 | 443 | ||
@@ -448,37 +449,37 @@ cleanup_task(void *cls) | |||
448 | * @param service the initialized service | 449 | * @param service the initialized service |
449 | */ | 450 | */ |
450 | static void | 451 | static void |
451 | run(void *cls, | 452 | run (void *cls, |
452 | const struct GNUNET_CONFIGURATION_Handle *cfg, | 453 | const struct GNUNET_CONFIGURATION_Handle *cfg, |
453 | struct GNUNET_SERVICE_Handle *service) | 454 | struct GNUNET_SERVICE_Handle *service) |
454 | { | 455 | { |
455 | GSA_stats = GNUNET_STATISTICS_create("ats", | 456 | GSA_stats = GNUNET_STATISTICS_create ("ats", |
456 | cfg); | 457 | cfg); |
457 | GAS_reservations_init(); | 458 | GAS_reservations_init (); |
458 | GAS_connectivity_init(); | 459 | GAS_connectivity_init (); |
459 | GAS_preference_init(); | 460 | GAS_preference_init (); |
460 | GAS_normalization_start(); | 461 | GAS_normalization_start (); |
461 | GAS_addresses_init(); | 462 | GAS_addresses_init (); |
462 | if (GNUNET_OK != | 463 | if (GNUNET_OK != |
463 | GAS_plugin_init(cfg)) | 464 | GAS_plugin_init (cfg)) |
465 | { | ||
466 | GNUNET_break (0); | ||
467 | GAS_addresses_done (); | ||
468 | GAS_normalization_stop (); | ||
469 | GAS_reservations_done (); | ||
470 | GAS_connectivity_done (); | ||
471 | GAS_preference_done (); | ||
472 | if (NULL != GSA_stats) | ||
464 | { | 473 | { |
465 | GNUNET_break(0); | 474 | GNUNET_STATISTICS_destroy (GSA_stats, |
466 | GAS_addresses_done(); | 475 | GNUNET_NO); |
467 | GAS_normalization_stop(); | 476 | GSA_stats = NULL; |
468 | GAS_reservations_done(); | ||
469 | GAS_connectivity_done(); | ||
470 | GAS_preference_done(); | ||
471 | if (NULL != GSA_stats) | ||
472 | { | ||
473 | GNUNET_STATISTICS_destroy(GSA_stats, | ||
474 | GNUNET_NO); | ||
475 | GSA_stats = NULL; | ||
476 | } | ||
477 | return; | ||
478 | } | 477 | } |
479 | GAS_performance_init(); | 478 | return; |
480 | GNUNET_SCHEDULER_add_shutdown(&cleanup_task, | 479 | } |
481 | NULL); | 480 | GAS_performance_init (); |
481 | GNUNET_SCHEDULER_add_shutdown (&cleanup_task, | ||
482 | NULL); | ||
482 | } | 483 | } |
483 | 484 | ||
484 | 485 | ||
@@ -492,47 +493,47 @@ GNUNET_SERVICE_MAIN | |||
492 | &client_connect_cb, | 493 | &client_connect_cb, |
493 | &client_disconnect_cb, | 494 | &client_disconnect_cb, |
494 | NULL, | 495 | NULL, |
495 | GNUNET_MQ_hd_fixed_size(ats_start, | 496 | GNUNET_MQ_hd_fixed_size (ats_start, |
496 | GNUNET_MESSAGE_TYPE_ATS_START, | 497 | GNUNET_MESSAGE_TYPE_ATS_START, |
497 | struct ClientStartMessage, | 498 | struct ClientStartMessage, |
498 | NULL), | 499 | NULL), |
499 | GNUNET_MQ_hd_fixed_size(request_address, | 500 | GNUNET_MQ_hd_fixed_size (request_address, |
500 | GNUNET_MESSAGE_TYPE_ATS_REQUEST_ADDRESS, | 501 | GNUNET_MESSAGE_TYPE_ATS_REQUEST_ADDRESS, |
501 | struct RequestAddressMessage, | 502 | struct RequestAddressMessage, |
502 | NULL), | 503 | NULL), |
503 | GNUNET_MQ_hd_fixed_size(request_address_cancel, | 504 | GNUNET_MQ_hd_fixed_size (request_address_cancel, |
504 | GNUNET_MESSAGE_TYPE_ATS_REQUEST_ADDRESS_CANCEL, | 505 | GNUNET_MESSAGE_TYPE_ATS_REQUEST_ADDRESS_CANCEL, |
505 | struct RequestAddressMessage, | 506 | struct RequestAddressMessage, |
506 | NULL), | 507 | NULL), |
507 | GNUNET_MQ_hd_fixed_size(request_address_list, | 508 | GNUNET_MQ_hd_fixed_size (request_address_list, |
508 | GNUNET_MESSAGE_TYPE_ATS_ADDRESSLIST_REQUEST, | 509 | GNUNET_MESSAGE_TYPE_ATS_ADDRESSLIST_REQUEST, |
509 | struct AddressListRequestMessage, | 510 | struct AddressListRequestMessage, |
510 | NULL), | 511 | NULL), |
511 | GNUNET_MQ_hd_var_size(address_add, | 512 | GNUNET_MQ_hd_var_size (address_add, |
512 | GNUNET_MESSAGE_TYPE_ATS_ADDRESS_ADD, | 513 | GNUNET_MESSAGE_TYPE_ATS_ADDRESS_ADD, |
513 | struct AddressAddMessage, | 514 | struct AddressAddMessage, |
514 | NULL), | 515 | NULL), |
515 | GNUNET_MQ_hd_fixed_size(address_update, | 516 | GNUNET_MQ_hd_fixed_size (address_update, |
516 | GNUNET_MESSAGE_TYPE_ATS_ADDRESS_UPDATE, | 517 | GNUNET_MESSAGE_TYPE_ATS_ADDRESS_UPDATE, |
517 | struct AddressUpdateMessage, | 518 | struct AddressUpdateMessage, |
518 | NULL), | 519 | NULL), |
519 | GNUNET_MQ_hd_fixed_size(address_destroyed, | 520 | GNUNET_MQ_hd_fixed_size (address_destroyed, |
520 | GNUNET_MESSAGE_TYPE_ATS_ADDRESS_DESTROYED, | 521 | GNUNET_MESSAGE_TYPE_ATS_ADDRESS_DESTROYED, |
521 | struct AddressDestroyedMessage, | 522 | struct AddressDestroyedMessage, |
522 | NULL), | 523 | NULL), |
523 | GNUNET_MQ_hd_fixed_size(reservation_request, | 524 | GNUNET_MQ_hd_fixed_size (reservation_request, |
524 | GNUNET_MESSAGE_TYPE_ATS_RESERVATION_REQUEST, | 525 | GNUNET_MESSAGE_TYPE_ATS_RESERVATION_REQUEST, |
525 | struct ReservationRequestMessage, | 526 | struct ReservationRequestMessage, |
526 | NULL), | 527 | NULL), |
527 | GNUNET_MQ_hd_var_size(preference_change, | 528 | GNUNET_MQ_hd_var_size (preference_change, |
528 | GNUNET_MESSAGE_TYPE_ATS_PREFERENCE_CHANGE, | 529 | GNUNET_MESSAGE_TYPE_ATS_PREFERENCE_CHANGE, |
529 | struct ChangePreferenceMessage, | 530 | struct ChangePreferenceMessage, |
530 | NULL), | 531 | NULL), |
531 | GNUNET_MQ_hd_var_size(feedback, | 532 | GNUNET_MQ_hd_var_size (feedback, |
532 | GNUNET_MESSAGE_TYPE_ATS_PREFERENCE_FEEDBACK, | 533 | GNUNET_MESSAGE_TYPE_ATS_PREFERENCE_FEEDBACK, |
533 | struct FeedbackPreferenceMessage, | 534 | struct FeedbackPreferenceMessage, |
534 | NULL), | 535 | NULL), |
535 | GNUNET_MQ_handler_end()); | 536 | GNUNET_MQ_handler_end ()); |
536 | 537 | ||
537 | 538 | ||
538 | /* end of gnunet-service-ats.c */ | 539 | /* end of gnunet-service-ats.c */ |