diff options
Diffstat (limited to 'src/social/gnunet-service-social.c')
-rw-r--r-- | src/social/gnunet-service-social.c | 31 |
1 files changed, 17 insertions, 14 deletions
diff --git a/src/social/gnunet-service-social.c b/src/social/gnunet-service-social.c index 1746a82ca..03a113d7e 100644 --- a/src/social/gnunet-service-social.c +++ b/src/social/gnunet-service-social.c | |||
@@ -408,8 +408,13 @@ static int | |||
408 | psyc_transmit_message (struct Place *plc); | 408 | psyc_transmit_message (struct Place *plc); |
409 | 409 | ||
410 | 410 | ||
411 | /** | ||
412 | * Clean up place data structures after a client disconnected. | ||
413 | * | ||
414 | * @param cls the `struct Place` to clean up | ||
415 | */ | ||
411 | static void | 416 | static void |
412 | cleanup_place (struct Place *plc); | 417 | cleanup_place (void *cls); |
413 | 418 | ||
414 | 419 | ||
415 | static struct MessageTransmitQueue * | 420 | static struct MessageTransmitQueue * |
@@ -426,7 +431,9 @@ place_entry_cleanup (void *cls, | |||
426 | const struct GNUNET_HashCode *key, | 431 | const struct GNUNET_HashCode *key, |
427 | void *value) | 432 | void *value) |
428 | { | 433 | { |
429 | cleanup_place (value); | 434 | struct Place *plc = value; |
435 | |||
436 | cleanup_place (plc); | ||
430 | return GNUNET_YES; | 437 | return GNUNET_YES; |
431 | } | 438 | } |
432 | 439 | ||
@@ -524,10 +531,14 @@ cleanup_guest (struct Guest *gst) | |||
524 | 531 | ||
525 | /** | 532 | /** |
526 | * Clean up place data structures after a client disconnected. | 533 | * Clean up place data structures after a client disconnected. |
534 | * | ||
535 | * @param cls the `struct Place` to clean up | ||
527 | */ | 536 | */ |
528 | static void | 537 | static void |
529 | cleanup_place (struct Place *plc) | 538 | cleanup_place (void *cls) |
530 | { | 539 | { |
540 | struct Place *plc = cls; | ||
541 | |||
531 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 542 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
532 | "%p Cleaning up place %s\n", | 543 | "%p Cleaning up place %s\n", |
533 | plc, GNUNET_h2s (&plc->pub_key_hash)); | 544 | plc, GNUNET_h2s (&plc->pub_key_hash)); |
@@ -541,13 +552,6 @@ cleanup_place (struct Place *plc) | |||
541 | } | 552 | } |
542 | 553 | ||
543 | 554 | ||
544 | static void | ||
545 | schedule_cleanup_place (void *cls) | ||
546 | { | ||
547 | cleanup_place (cls); | ||
548 | } | ||
549 | |||
550 | |||
551 | /** | 555 | /** |
552 | * Called whenever a client is disconnected. | 556 | * Called whenever a client is disconnected. |
553 | * Frees our resources associated with that client. | 557 | * Frees our resources associated with that client. |
@@ -2329,7 +2333,7 @@ psyc_transmit_notify_data (void *cls, uint16_t *data_size, void *data) | |||
2329 | tmit_msg = psyc_transmit_queue_next_msg (plc, tmit_msg); | 2333 | tmit_msg = psyc_transmit_queue_next_msg (plc, tmit_msg); |
2330 | plc->is_disconnected = GNUNET_YES; | 2334 | plc->is_disconnected = GNUNET_YES; |
2331 | GNUNET_SERVER_client_disconnect (tmit_frag->client); | 2335 | GNUNET_SERVER_client_disconnect (tmit_frag->client); |
2332 | GNUNET_SCHEDULER_add_now (&schedule_cleanup_place, plc); | 2336 | GNUNET_SCHEDULER_add_now (&cleanup_place, plc); |
2333 | return ret; | 2337 | return ret; |
2334 | } | 2338 | } |
2335 | else | 2339 | else |
@@ -2489,7 +2493,7 @@ psyc_transmit_notify_mod (void *cls, uint16_t *data_size, void *data, | |||
2489 | tmit_msg = psyc_transmit_queue_next_msg (plc, tmit_msg); | 2493 | tmit_msg = psyc_transmit_queue_next_msg (plc, tmit_msg); |
2490 | plc->is_disconnected = GNUNET_YES; | 2494 | plc->is_disconnected = GNUNET_YES; |
2491 | GNUNET_SERVER_client_disconnect (tmit_frag->client); | 2495 | GNUNET_SERVER_client_disconnect (tmit_frag->client); |
2492 | GNUNET_SCHEDULER_add_now (&schedule_cleanup_place, plc); | 2496 | GNUNET_SCHEDULER_add_now (&cleanup_place, plc); |
2493 | } | 2497 | } |
2494 | else | 2498 | else |
2495 | { | 2499 | { |
@@ -3480,8 +3484,7 @@ run (void *cls, struct GNUNET_SERVER_Handle *server, | |||
3480 | nc = GNUNET_SERVER_notification_context_create (server, 1); | 3484 | nc = GNUNET_SERVER_notification_context_create (server, 1); |
3481 | GNUNET_SERVER_add_handlers (server, handlers); | 3485 | GNUNET_SERVER_add_handlers (server, handlers); |
3482 | GNUNET_SERVER_disconnect_notify (server, &client_disconnect, NULL); | 3486 | GNUNET_SERVER_disconnect_notify (server, &client_disconnect, NULL); |
3483 | GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_FOREVER_REL, | 3487 | GNUNET_SCHEDULER_add_shutdown (&shutdown_task, NULL); |
3484 | &shutdown_task, NULL); | ||
3485 | } | 3488 | } |
3486 | 3489 | ||
3487 | 3490 | ||