aboutsummaryrefslogtreecommitdiff
path: root/src/fs/gnunet-service-fs_cadet_server.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/fs/gnunet-service-fs_cadet_server.c')
-rw-r--r--src/fs/gnunet-service-fs_cadet_server.c456
1 files changed, 230 insertions, 226 deletions
diff --git a/src/fs/gnunet-service-fs_cadet_server.c b/src/fs/gnunet-service-fs_cadet_server.c
index 68e87f092..34e4e6f58 100644
--- a/src/fs/gnunet-service-fs_cadet_server.c
+++ b/src/fs/gnunet-service-fs_cadet_server.c
@@ -40,13 +40,14 @@
40/** 40/**
41 * After how long do we termiante idle connections? 41 * After how long do we termiante idle connections?
42 */ 42 */
43#define IDLE_TIMEOUT GNUNET_TIME_relative_multiply(GNUNET_TIME_UNIT_MINUTES, 2) 43#define IDLE_TIMEOUT GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_MINUTES, 2)
44 44
45 45
46/** 46/**
47 * A message in the queue to be written to the cadet. 47 * A message in the queue to be written to the cadet.
48 */ 48 */
49struct WriteQueueItem { 49struct WriteQueueItem
50{
50 /** 51 /**
51 * Kept in a DLL. 52 * Kept in a DLL.
52 */ 53 */
@@ -67,7 +68,8 @@ struct WriteQueueItem {
67/** 68/**
68 * Information we keep around for each active cadeting client. 69 * Information we keep around for each active cadeting client.
69 */ 70 */
70struct CadetClient { 71struct CadetClient
72{
71 /** 73 /**
72 * DLL 74 * DLL
73 */ 75 */
@@ -101,12 +103,12 @@ struct CadetClient {
101 /** 103 /**
102 * Task that is scheduled to asynchronously terminate the connection. 104 * Task that is scheduled to asynchronously terminate the connection.
103 */ 105 */
104 struct GNUNET_SCHEDULER_Task * terminate_task; 106 struct GNUNET_SCHEDULER_Task *terminate_task;
105 107
106 /** 108 /**
107 * Task that is scheduled to terminate idle connections. 109 * Task that is scheduled to terminate idle connections.
108 */ 110 */
109 struct GNUNET_SCHEDULER_Task * timeout_task; 111 struct GNUNET_SCHEDULER_Task *timeout_task;
110 112
111 /** 113 /**
112 * Size of the last write that was initiated. 114 * Size of the last write that was initiated.
@@ -148,7 +150,7 @@ static unsigned long long sc_count_max;
148 * @param cls the 'struct CadetClient' 150 * @param cls the 'struct CadetClient'
149 */ 151 */
150static void 152static void
151timeout_cadet_task(void *cls) 153timeout_cadet_task (void *cls)
152{ 154{
153 struct CadetClient *sc = cls; 155 struct CadetClient *sc = cls;
154 struct GNUNET_CADET_Channel *tun; 156 struct GNUNET_CADET_Channel *tun;
@@ -156,10 +158,10 @@ timeout_cadet_task(void *cls)
156 sc->timeout_task = NULL; 158 sc->timeout_task = NULL;
157 tun = sc->channel; 159 tun = sc->channel;
158 sc->channel = NULL; 160 sc->channel = NULL;
159 GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, 161 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
160 "Timeout for inactive cadet client %p\n", 162 "Timeout for inactive cadet client %p\n",
161 sc); 163 sc);
162 GNUNET_CADET_channel_destroy(tun); 164 GNUNET_CADET_channel_destroy (tun);
163} 165}
164 166
165 167
@@ -169,13 +171,13 @@ timeout_cadet_task(void *cls)
169 * @param sc client handle to reset timeout for 171 * @param sc client handle to reset timeout for
170 */ 172 */
171static void 173static void
172refresh_timeout_task(struct CadetClient *sc) 174refresh_timeout_task (struct CadetClient *sc)
173{ 175{
174 if (NULL != sc->timeout_task) 176 if (NULL != sc->timeout_task)
175 GNUNET_SCHEDULER_cancel(sc->timeout_task); 177 GNUNET_SCHEDULER_cancel (sc->timeout_task);
176 sc->timeout_task = GNUNET_SCHEDULER_add_delayed(IDLE_TIMEOUT, 178 sc->timeout_task = GNUNET_SCHEDULER_add_delayed (IDLE_TIMEOUT,
177 &timeout_cadet_task, 179 &timeout_cadet_task,
178 sc); 180 sc);
179} 181}
180 182
181 183
@@ -186,23 +188,23 @@ refresh_timeout_task(struct CadetClient *sc)
186 * @param cls where to process the write queue 188 * @param cls where to process the write queue
187 */ 189 */
188static void 190static void
189continue_writing(void *cls) 191continue_writing (void *cls)
190{ 192{
191 struct CadetClient *sc = cls; 193 struct CadetClient *sc = cls;
192 struct GNUNET_MQ_Handle *mq; 194 struct GNUNET_MQ_Handle *mq;
193 195
194 mq = GNUNET_CADET_get_mq(sc->channel); 196 mq = GNUNET_CADET_get_mq (sc->channel);
195 if (0 != GNUNET_MQ_get_length(mq)) 197 if (0 != GNUNET_MQ_get_length (mq))
196 { 198 {
197 GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, 199 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
198 "Write pending, waiting for it to complete\n"); 200 "Write pending, waiting for it to complete\n");
199 return; 201 return;
200 } 202 }
201 refresh_timeout_task(sc); 203 refresh_timeout_task (sc);
202 GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, 204 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
203 "Finished processing cadet request from client %p, ready to receive the next one\n", 205 "Finished processing cadet request from client %p, ready to receive the next one\n",
204 sc); 206 sc);
205 GNUNET_CADET_receive_done(sc->channel); 207 GNUNET_CADET_receive_done (sc->channel);
206} 208}
207 209
208 210
@@ -222,16 +224,16 @@ continue_writing(void *cls)
222 * maybe 0 if no unique identifier is available 224 * maybe 0 if no unique identifier is available
223 */ 225 */
224static void 226static void
225handle_datastore_reply(void *cls, 227handle_datastore_reply (void *cls,
226 const struct GNUNET_HashCode *key, 228 const struct GNUNET_HashCode *key,
227 size_t size, 229 size_t size,
228 const void *data, 230 const void *data,
229 enum GNUNET_BLOCK_Type type, 231 enum GNUNET_BLOCK_Type type,
230 uint32_t priority, 232 uint32_t priority,
231 uint32_t anonymity, 233 uint32_t anonymity,
232 uint32_t replication, 234 uint32_t replication,
233 struct GNUNET_TIME_Absolute expiration, 235 struct GNUNET_TIME_Absolute expiration,
234 uint64_t uid) 236 uint64_t uid)
235{ 237{
236 struct CadetClient *sc = cls; 238 struct CadetClient *sc = cls;
237 size_t msize = size + sizeof(struct CadetReplyMessage); 239 size_t msize = size + sizeof(struct CadetReplyMessage);
@@ -240,85 +242,86 @@ handle_datastore_reply(void *cls,
240 242
241 sc->qe = NULL; 243 sc->qe = NULL;
242 if (NULL == data) 244 if (NULL == data)
245 {
246 /* no result, this should not really happen, as for
247 non-anonymous routing only peers that HAVE the
248 answers should be queried; OTOH, this is not a
249 hard error as we might have had the answer in the
250 past and the user might have unindexed it. Hence
251 we log at level "INFO" for now. */
252 if (NULL == key)
243 { 253 {
244 /* no result, this should not really happen, as for 254 GNUNET_log (GNUNET_ERROR_TYPE_INFO,
245 non-anonymous routing only peers that HAVE the 255 "Have no answer and the query was NULL\n");
246 answers should be queried; OTOH, this is not a
247 hard error as we might have had the answer in the
248 past and the user might have unindexed it. Hence
249 we log at level "INFO" for now. */
250 if (NULL == key)
251 {
252 GNUNET_log(GNUNET_ERROR_TYPE_INFO,
253 "Have no answer and the query was NULL\n");
254 }
255 else
256 {
257 GNUNET_log(GNUNET_ERROR_TYPE_INFO,
258 "Have no answer for query `%s'\n",
259 GNUNET_h2s(key));
260 }
261 GNUNET_STATISTICS_update(GSF_stats,
262 gettext_noop("# queries received via CADET not answered"),
263 1,
264 GNUNET_NO);
265 continue_writing(sc);
266 return;
267 } 256 }
268 if (GNUNET_BLOCK_TYPE_FS_ONDEMAND == type) 257 else
269 { 258 {
270 GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, 259 GNUNET_log (GNUNET_ERROR_TYPE_INFO,
271 "Performing on-demand encoding for query %s\n", 260 "Have no answer for query `%s'\n",
272 GNUNET_h2s(key)); 261 GNUNET_h2s (key));
273 if (GNUNET_OK !=
274 GNUNET_FS_handle_on_demand_block(key,
275 size,
276 data,
277 type,
278 priority,
279 anonymity,
280 replication,
281 expiration,
282 uid,
283 &handle_datastore_reply,
284 sc))
285 {
286 GNUNET_log(GNUNET_ERROR_TYPE_DEBUG,
287 "On-demand encoding request failed\n");
288 continue_writing(sc);
289 }
290 return;
291 } 262 }
292 if (msize > GNUNET_MAX_MESSAGE_SIZE) 263 GNUNET_STATISTICS_update (GSF_stats,
264 gettext_noop (
265 "# queries received via CADET not answered"),
266 1,
267 GNUNET_NO);
268 continue_writing (sc);
269 return;
270 }
271 if (GNUNET_BLOCK_TYPE_FS_ONDEMAND == type)
272 {
273 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
274 "Performing on-demand encoding for query %s\n",
275 GNUNET_h2s (key));
276 if (GNUNET_OK !=
277 GNUNET_FS_handle_on_demand_block (key,
278 size,
279 data,
280 type,
281 priority,
282 anonymity,
283 replication,
284 expiration,
285 uid,
286 &handle_datastore_reply,
287 sc))
293 { 288 {
294 GNUNET_break(0); 289 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
295 continue_writing(sc); 290 "On-demand encoding request failed\n");
296 return; 291 continue_writing (sc);
297 } 292 }
298 GNUNET_break(GNUNET_BLOCK_TYPE_ANY != type); 293 return;
299 GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, 294 }
300 "Starting transmission of %u byte reply of type %d for query `%s' via cadet to %p\n", 295 if (msize > GNUNET_MAX_MESSAGE_SIZE)
301 (unsigned int)size, 296 {
302 (unsigned int)type, 297 GNUNET_break (0);
303 GNUNET_h2s(key), 298 continue_writing (sc);
304 sc); 299 return;
305 env = GNUNET_MQ_msg_extra(srm, 300 }
306 size, 301 GNUNET_break (GNUNET_BLOCK_TYPE_ANY != type);
307 GNUNET_MESSAGE_TYPE_FS_CADET_REPLY); 302 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
308 srm->type = htonl(type); 303 "Starting transmission of %u byte reply of type %d for query `%s' via cadet to %p\n",
309 srm->expiration = GNUNET_TIME_absolute_hton(expiration); 304 (unsigned int) size,
310 GNUNET_memcpy(&srm[1], 305 (unsigned int) type,
311 data, 306 GNUNET_h2s (key),
312 size); 307 sc);
313 GNUNET_MQ_notify_sent(env, 308 env = GNUNET_MQ_msg_extra (srm,
314 &continue_writing, 309 size,
315 sc); 310 GNUNET_MESSAGE_TYPE_FS_CADET_REPLY);
316 GNUNET_STATISTICS_update(GSF_stats, 311 srm->type = htonl (type);
317 gettext_noop("# Blocks transferred via cadet"), 312 srm->expiration = GNUNET_TIME_absolute_hton (expiration);
318 1, 313 GNUNET_memcpy (&srm[1],
319 GNUNET_NO); 314 data,
320 GNUNET_MQ_send(GNUNET_CADET_get_mq(sc->channel), 315 size);
321 env); 316 GNUNET_MQ_notify_sent (env,
317 &continue_writing,
318 sc);
319 GNUNET_STATISTICS_update (GSF_stats,
320 gettext_noop ("# Blocks transferred via cadet"),
321 1,
322 GNUNET_NO);
323 GNUNET_MQ_send (GNUNET_CADET_get_mq (sc->channel),
324 env);
322} 325}
323 326
324 327
@@ -330,35 +333,35 @@ handle_datastore_reply(void *cls,
330 * @param sqm the actual message 333 * @param sqm the actual message
331 */ 334 */
332static void 335static void
333handle_request(void *cls, 336handle_request (void *cls,
334 const struct CadetQueryMessage *sqm) 337 const struct CadetQueryMessage *sqm)
335{ 338{
336 struct CadetClient *sc = cls; 339 struct CadetClient *sc = cls;
337 340
338 GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, 341 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
339 "Received query for `%s' via cadet from client %p\n", 342 "Received query for `%s' via cadet from client %p\n",
340 GNUNET_h2s(&sqm->query), 343 GNUNET_h2s (&sqm->query),
341 sc); 344 sc);
342 GNUNET_STATISTICS_update(GSF_stats, 345 GNUNET_STATISTICS_update (GSF_stats,
343 gettext_noop("# queries received via cadet"), 346 gettext_noop ("# queries received via cadet"),
344 1, 347 1,
345 GNUNET_NO); 348 GNUNET_NO);
346 refresh_timeout_task(sc); 349 refresh_timeout_task (sc);
347 sc->qe = GNUNET_DATASTORE_get_key(GSF_dsh, 350 sc->qe = GNUNET_DATASTORE_get_key (GSF_dsh,
348 0 /* next_uid */, 351 0 /* next_uid */,
349 false /* random */, 352 false /* random */,
350 &sqm->query, 353 &sqm->query,
351 ntohl(sqm->type), 354 ntohl (sqm->type),
352 0 /* priority */, 355 0 /* priority */,
353 GSF_datastore_queue_size, 356 GSF_datastore_queue_size,
354 &handle_datastore_reply, 357 &handle_datastore_reply,
355 sc); 358 sc);
356 if (NULL == sc->qe) 359 if (NULL == sc->qe)
357 { 360 {
358 GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, 361 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
359 "Queueing request with datastore failed (queue full?)\n"); 362 "Queueing request with datastore failed (queue full?)\n");
360 continue_writing(sc); 363 continue_writing (sc);
361 } 364 }
362} 365}
363 366
364 367
@@ -372,37 +375,38 @@ handle_request(void *cls,
372 * @return initial channel context (our `struct CadetClient`) 375 * @return initial channel context (our `struct CadetClient`)
373 */ 376 */
374static void * 377static void *
375connect_cb(void *cls, 378connect_cb (void *cls,
376 struct GNUNET_CADET_Channel *channel, 379 struct GNUNET_CADET_Channel *channel,
377 const struct GNUNET_PeerIdentity *initiator) 380 const struct GNUNET_PeerIdentity *initiator)
378{ 381{
379 struct CadetClient *sc; 382 struct CadetClient *sc;
380 383
381 GNUNET_assert(NULL != channel); 384 GNUNET_assert (NULL != channel);
382 if (sc_count >= sc_count_max) 385 if (sc_count >= sc_count_max)
383 { 386 {
384 GNUNET_STATISTICS_update(GSF_stats, 387 GNUNET_STATISTICS_update (GSF_stats,
385 gettext_noop("# cadet client connections rejected"), 388 gettext_noop (
386 1, 389 "# cadet client connections rejected"),
387 GNUNET_NO); 390 1,
388 GNUNET_CADET_channel_destroy(channel); 391 GNUNET_NO);
389 return NULL; 392 GNUNET_CADET_channel_destroy (channel);
390 } 393 return NULL;
391 GNUNET_STATISTICS_update(GSF_stats, 394 }
392 gettext_noop("# cadet connections active"), 395 GNUNET_STATISTICS_update (GSF_stats,
393 1, 396 gettext_noop ("# cadet connections active"),
394 GNUNET_NO); 397 1,
395 sc = GNUNET_new(struct CadetClient); 398 GNUNET_NO);
399 sc = GNUNET_new (struct CadetClient);
396 sc->channel = channel; 400 sc->channel = channel;
397 GNUNET_CONTAINER_DLL_insert(sc_head, 401 GNUNET_CONTAINER_DLL_insert (sc_head,
398 sc_tail, 402 sc_tail,
399 sc); 403 sc);
400 sc_count++; 404 sc_count++;
401 refresh_timeout_task(sc); 405 refresh_timeout_task (sc);
402 GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, 406 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
403 "Accepting inbound cadet connection from `%s' as client %p\n", 407 "Accepting inbound cadet connection from `%s' as client %p\n",
404 GNUNET_i2s(initiator), 408 GNUNET_i2s (initiator),
405 sc); 409 sc);
406 return sc; 410 return sc;
407} 411}
408 412
@@ -416,8 +420,8 @@ connect_cb(void *cls,
416 * @param channel_ctx 420 * @param channel_ctx
417 */ 421 */
418static void 422static void
419disconnect_cb(void *cls, 423disconnect_cb (void *cls,
420 const struct GNUNET_CADET_Channel *channel) 424 const struct GNUNET_CADET_Channel *channel)
421{ 425{
422 struct CadetClient *sc = cls; 426 struct CadetClient *sc = cls;
423 struct WriteQueueItem *wqi; 427 struct WriteQueueItem *wqi;
@@ -425,30 +429,30 @@ disconnect_cb(void *cls,
425 if (NULL == sc) 429 if (NULL == sc)
426 return; 430 return;
427 sc->channel = NULL; 431 sc->channel = NULL;
428 GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, 432 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
429 "Terminating cadet connection with client %p\n", 433 "Terminating cadet connection with client %p\n",
430 sc); 434 sc);
431 GNUNET_STATISTICS_update(GSF_stats, 435 GNUNET_STATISTICS_update (GSF_stats,
432 gettext_noop("# cadet connections active"), -1, 436 gettext_noop ("# cadet connections active"), -1,
433 GNUNET_NO); 437 GNUNET_NO);
434 if (NULL != sc->terminate_task) 438 if (NULL != sc->terminate_task)
435 GNUNET_SCHEDULER_cancel(sc->terminate_task); 439 GNUNET_SCHEDULER_cancel (sc->terminate_task);
436 if (NULL != sc->timeout_task) 440 if (NULL != sc->timeout_task)
437 GNUNET_SCHEDULER_cancel(sc->timeout_task); 441 GNUNET_SCHEDULER_cancel (sc->timeout_task);
438 if (NULL != sc->qe) 442 if (NULL != sc->qe)
439 GNUNET_DATASTORE_cancel(sc->qe); 443 GNUNET_DATASTORE_cancel (sc->qe);
440 while (NULL != (wqi = sc->wqi_head)) 444 while (NULL != (wqi = sc->wqi_head))
441 { 445 {
442 GNUNET_CONTAINER_DLL_remove(sc->wqi_head, 446 GNUNET_CONTAINER_DLL_remove (sc->wqi_head,
443 sc->wqi_tail, 447 sc->wqi_tail,
444 wqi); 448 wqi);
445 GNUNET_free(wqi); 449 GNUNET_free (wqi);
446 } 450 }
447 GNUNET_CONTAINER_DLL_remove(sc_head, 451 GNUNET_CONTAINER_DLL_remove (sc_head,
448 sc_tail, 452 sc_tail,
449 sc); 453 sc);
450 sc_count--; 454 sc_count--;
451 GNUNET_free(sc); 455 GNUNET_free (sc);
452} 456}
453 457
454 458
@@ -467,9 +471,9 @@ disconnect_cb(void *cls,
467 * this value will be negative.. 471 * this value will be negative..
468 */ 472 */
469static void 473static void
470window_change_cb(void *cls, 474window_change_cb (void *cls,
471 const struct GNUNET_CADET_Channel *channel, 475 const struct GNUNET_CADET_Channel *channel,
472 int window_size) 476 int window_size)
473{ 477{
474 /* FIXME: could do flow control here... */ 478 /* FIXME: could do flow control here... */
475} 479}
@@ -479,39 +483,39 @@ window_change_cb(void *cls,
479 * Initialize subsystem for non-anonymous file-sharing. 483 * Initialize subsystem for non-anonymous file-sharing.
480 */ 484 */
481void 485void
482GSF_cadet_start_server() 486GSF_cadet_start_server ()
483{ 487{
484 struct GNUNET_MQ_MessageHandler handlers[] = { 488 struct GNUNET_MQ_MessageHandler handlers[] = {
485 GNUNET_MQ_hd_fixed_size(request, 489 GNUNET_MQ_hd_fixed_size (request,
486 GNUNET_MESSAGE_TYPE_FS_CADET_QUERY, 490 GNUNET_MESSAGE_TYPE_FS_CADET_QUERY,
487 struct CadetQueryMessage, 491 struct CadetQueryMessage,
488 NULL), 492 NULL),
489 GNUNET_MQ_handler_end() 493 GNUNET_MQ_handler_end ()
490 }; 494 };
491 struct GNUNET_HashCode port; 495 struct GNUNET_HashCode port;
492 496
493 if (GNUNET_YES != 497 if (GNUNET_YES !=
494 GNUNET_CONFIGURATION_get_value_number(GSF_cfg, 498 GNUNET_CONFIGURATION_get_value_number (GSF_cfg,
495 "fs", 499 "fs",
496 "MAX_CADET_CLIENTS", 500 "MAX_CADET_CLIENTS",
497 &sc_count_max)) 501 &sc_count_max))
498 return; 502 return;
499 GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, 503 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
500 "Initializing cadet FS server with a limit of %llu connections\n", 504 "Initializing cadet FS server with a limit of %llu connections\n",
501 sc_count_max); 505 sc_count_max);
502 cadet_map = GNUNET_CONTAINER_multipeermap_create(16, GNUNET_YES); 506 cadet_map = GNUNET_CONTAINER_multipeermap_create (16, GNUNET_YES);
503 cadet_handle = GNUNET_CADET_connect(GSF_cfg); 507 cadet_handle = GNUNET_CADET_connect (GSF_cfg);
504 GNUNET_assert(NULL != cadet_handle); 508 GNUNET_assert (NULL != cadet_handle);
505 GNUNET_CRYPTO_hash(GNUNET_APPLICATION_PORT_FS_BLOCK_TRANSFER, 509 GNUNET_CRYPTO_hash (GNUNET_APPLICATION_PORT_FS_BLOCK_TRANSFER,
506 strlen(GNUNET_APPLICATION_PORT_FS_BLOCK_TRANSFER), 510 strlen (GNUNET_APPLICATION_PORT_FS_BLOCK_TRANSFER),
507 &port); 511 &port);
508 cadet_port = GNUNET_CADET_open_port(cadet_handle, 512 cadet_port = GNUNET_CADET_open_port (cadet_handle,
509 &port, 513 &port,
510 &connect_cb, 514 &connect_cb,
511 NULL, 515 NULL,
512 &window_change_cb, 516 &window_change_cb,
513 &disconnect_cb, 517 &disconnect_cb,
514 handlers); 518 handlers);
515} 519}
516 520
517 521
@@ -519,25 +523,25 @@ GSF_cadet_start_server()
519 * Shutdown subsystem for non-anonymous file-sharing. 523 * Shutdown subsystem for non-anonymous file-sharing.
520 */ 524 */
521void 525void
522GSF_cadet_stop_server() 526GSF_cadet_stop_server ()
523{ 527{
524 GNUNET_CONTAINER_multipeermap_iterate(cadet_map, 528 GNUNET_CONTAINER_multipeermap_iterate (cadet_map,
525 &GSF_cadet_release_clients, 529 &GSF_cadet_release_clients,
526 NULL); 530 NULL);
527 GNUNET_CONTAINER_multipeermap_destroy(cadet_map); 531 GNUNET_CONTAINER_multipeermap_destroy (cadet_map);
528 cadet_map = NULL; 532 cadet_map = NULL;
529 if (NULL != cadet_port) 533 if (NULL != cadet_port)
530 { 534 {
531 GNUNET_CADET_close_port(cadet_port); 535 GNUNET_CADET_close_port (cadet_port);
532 cadet_port = NULL; 536 cadet_port = NULL;
533 } 537 }
534 if (NULL != cadet_handle) 538 if (NULL != cadet_handle)
535 { 539 {
536 GNUNET_CADET_disconnect(cadet_handle); 540 GNUNET_CADET_disconnect (cadet_handle);
537 cadet_handle = NULL; 541 cadet_handle = NULL;
538 } 542 }
539 GNUNET_assert(NULL == sc_head); 543 GNUNET_assert (NULL == sc_head);
540 GNUNET_assert(0 == sc_count); 544 GNUNET_assert (0 == sc_count);
541} 545}
542 546
543/* end of gnunet-service-fs_cadet.c */ 547/* end of gnunet-service-fs_cadet.c */