diff options
author | Christian Grothoff <christian@grothoff.org> | 2012-04-22 19:52:39 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2012-04-22 19:52:39 +0000 |
commit | e2bf225a32bb93731b574ad698f20acbb92a5803 (patch) | |
tree | dc151b39eb6bb96eaa03c447a92205e8c4254b58 /src/transport/gnunet-service-transport_blacklist.c | |
parent | 9ba0af50e8f41d40163bbac21003261928084c48 (diff) | |
download | gnunet-e2bf225a32bb93731b574ad698f20acbb92a5803.tar.gz gnunet-e2bf225a32bb93731b574ad698f20acbb92a5803.zip |
introducing soft shutdown concept for services; during soft shutdown, services that are still managing non-monitor clients continue to run until those clients disconnect; however, the services do stop to accept new connections (will stop listening); soft shutdown is now used by ats, transport, peerinfo, namestore and most importantly statistics; this should fix #2197
Diffstat (limited to 'src/transport/gnunet-service-transport_blacklist.c')
-rw-r--r-- | src/transport/gnunet-service-transport_blacklist.c | 20 |
1 files changed, 1 insertions, 19 deletions
diff --git a/src/transport/gnunet-service-transport_blacklist.c b/src/transport/gnunet-service-transport_blacklist.c index 44a029474..8c368886b 100644 --- a/src/transport/gnunet-service-transport_blacklist.c +++ b/src/transport/gnunet-service-transport_blacklist.c | |||
@@ -230,11 +230,9 @@ read_blacklist_file () | |||
230 | GNUNET_CONFIGURATION_get_value_filename (GST_cfg, "TRANSPORT", | 230 | GNUNET_CONFIGURATION_get_value_filename (GST_cfg, "TRANSPORT", |
231 | "BLACKLIST_FILE", &fn)) | 231 | "BLACKLIST_FILE", &fn)) |
232 | { | 232 | { |
233 | #if DEBUG_TRANSPORT | ||
234 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 233 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
235 | "Option `%s' in section `%s' not specified!\n", | 234 | "Option `%s' in section `%s' not specified!\n", |
236 | "BLACKLIST_FILE", "TRANSPORT"); | 235 | "BLACKLIST_FILE", "TRANSPORT"); |
237 | #endif | ||
238 | return; | 236 | return; |
239 | } | 237 | } |
240 | if (GNUNET_OK != GNUNET_DISK_file_test (fn)) | 238 | if (GNUNET_OK != GNUNET_DISK_file_test (fn)) |
@@ -251,10 +249,8 @@ read_blacklist_file () | |||
251 | } | 249 | } |
252 | if (fsize == 0) | 250 | if (fsize == 0) |
253 | { | 251 | { |
254 | #if DEBUG_TRANSPORT | ||
255 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, _("Blacklist file `%s' is empty.\n"), | 252 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, _("Blacklist file `%s' is empty.\n"), |
256 | fn); | 253 | fn); |
257 | #endif | ||
258 | GNUNET_free (fn); | 254 | GNUNET_free (fn); |
259 | return; | 255 | return; |
260 | } | 256 | } |
@@ -322,11 +318,9 @@ read_blacklist_file () | |||
322 | transport_name = GNUNET_malloc (tsize + 1); | 318 | transport_name = GNUNET_malloc (tsize + 1); |
323 | memcpy (transport_name, &data[pos], tsize); | 319 | memcpy (transport_name, &data[pos], tsize); |
324 | pos = colon_pos + 1; | 320 | pos = colon_pos + 1; |
325 | #if DEBUG_TRANSPORT | ||
326 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 321 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
327 | "Read transport name `%s' in blacklist file.\n", | 322 | "Read transport name `%s' in blacklist file.\n", |
328 | transport_name); | 323 | transport_name); |
329 | #endif | ||
330 | memcpy (&enc, &data[pos], sizeof (struct GNUNET_CRYPTO_HashAsciiEncoded)); | 324 | memcpy (&enc, &data[pos], sizeof (struct GNUNET_CRYPTO_HashAsciiEncoded)); |
331 | if (!isspace | 325 | if (!isspace |
332 | ((unsigned char) | 326 | ((unsigned char) |
@@ -451,11 +445,9 @@ transmit_blacklist_message (void *cls, size_t size, void *buf) | |||
451 | GNUNET_i2s (&bc->peer)); | 445 | GNUNET_i2s (&bc->peer)); |
452 | return 0; | 446 | return 0; |
453 | } | 447 | } |
454 | #if DEBUG_TRANSPORT | ||
455 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 448 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
456 | "Sending blacklist test for peer `%s' to client\n", | 449 | "Sending blacklist test for peer `%s' to client\n", |
457 | GNUNET_i2s (&bc->peer)); | 450 | GNUNET_i2s (&bc->peer)); |
458 | #endif | ||
459 | bl = bc->bl_pos; | 451 | bl = bc->bl_pos; |
460 | bm.header.size = htons (sizeof (struct BlacklistMessage)); | 452 | bm.header.size = htons (sizeof (struct BlacklistMessage)); |
461 | bm.header.type = htons (GNUNET_MESSAGE_TYPE_TRANSPORT_BLACKLIST_QUERY); | 453 | bm.header.type = htons (GNUNET_MESSAGE_TYPE_TRANSPORT_BLACKLIST_QUERY); |
@@ -484,11 +476,9 @@ do_blacklist_check (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
484 | bl = bc->bl_pos; | 476 | bl = bc->bl_pos; |
485 | if (bl == NULL) | 477 | if (bl == NULL) |
486 | { | 478 | { |
487 | #if DEBUG_TRANSPORT | ||
488 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 479 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
489 | "No other blacklist clients active, will allow neighbour `%s'\n", | 480 | "No other blacklist clients active, will allow neighbour `%s'\n", |
490 | GNUNET_i2s (&bc->peer)); | 481 | GNUNET_i2s (&bc->peer)); |
491 | #endif | ||
492 | bc->cont (bc->cont_cls, &bc->peer, GNUNET_OK); | 482 | bc->cont (bc->cont_cls, &bc->peer, GNUNET_OK); |
493 | GNUNET_CONTAINER_DLL_remove(bc_head, bc_tail, bc); | 483 | GNUNET_CONTAINER_DLL_remove(bc_head, bc_tail, bc); |
494 | GNUNET_free (bc); | 484 | GNUNET_free (bc); |
@@ -579,7 +569,6 @@ test_connection_ok (void *cls, const struct GNUNET_PeerIdentity *neighbour, | |||
579 | } | 569 | } |
580 | 570 | ||
581 | 571 | ||
582 | |||
583 | /** | 572 | /** |
584 | * Initialize a blacklisting client. We got a blacklist-init | 573 | * Initialize a blacklisting client. We got a blacklist-init |
585 | * message from this client, add him to the list of clients | 574 | * message from this client, add him to the list of clients |
@@ -607,6 +596,7 @@ GST_blacklist_handle_init (void *cls, struct GNUNET_SERVER_Client *client, | |||
607 | } | 596 | } |
608 | bl = bl->next; | 597 | bl = bl->next; |
609 | } | 598 | } |
599 | GNUNET_SERVER_client_mark_monitor (client); | ||
610 | bl = GNUNET_malloc (sizeof (struct Blacklisters)); | 600 | bl = GNUNET_malloc (sizeof (struct Blacklisters)); |
611 | bl->client = client; | 601 | bl->client = client; |
612 | GNUNET_SERVER_client_keep (client); | 602 | GNUNET_SERVER_client_keep (client); |
@@ -640,9 +630,7 @@ GST_blacklist_handle_reply (void *cls, struct GNUNET_SERVER_Client *client, | |||
640 | bl = bl->next; | 630 | bl = bl->next; |
641 | if (bl == NULL) | 631 | if (bl == NULL) |
642 | { | 632 | { |
643 | #if DEBUG_TRANSPORT | ||
644 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Blacklist client disconnected\n"); | 633 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Blacklist client disconnected\n"); |
645 | #endif | ||
646 | /* FIXME: other error handling here!? */ | 634 | /* FIXME: other error handling here!? */ |
647 | GNUNET_SERVER_receive_done (client, GNUNET_SYSERR); | 635 | GNUNET_SERVER_receive_done (client, GNUNET_SYSERR); |
648 | return; | 636 | return; |
@@ -656,20 +644,16 @@ GST_blacklist_handle_reply (void *cls, struct GNUNET_SERVER_Client *client, | |||
656 | * cancelled in the meantime... */ | 644 | * cancelled in the meantime... */ |
657 | if (ntohl (msg->is_allowed) == GNUNET_SYSERR) | 645 | if (ntohl (msg->is_allowed) == GNUNET_SYSERR) |
658 | { | 646 | { |
659 | #if DEBUG_TRANSPORT | ||
660 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 647 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
661 | "Blacklist check failed, peer not allowed\n"); | 648 | "Blacklist check failed, peer not allowed\n"); |
662 | #endif | ||
663 | bc->cont (bc->cont_cls, &bc->peer, GNUNET_NO); | 649 | bc->cont (bc->cont_cls, &bc->peer, GNUNET_NO); |
664 | GNUNET_CONTAINER_DLL_remove (bc_head, bc_tail, bc); | 650 | GNUNET_CONTAINER_DLL_remove (bc_head, bc_tail, bc); |
665 | GNUNET_free (bc); | 651 | GNUNET_free (bc); |
666 | } | 652 | } |
667 | else | 653 | else |
668 | { | 654 | { |
669 | #if DEBUG_TRANSPORT | ||
670 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 655 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
671 | "Blacklist check succeeded, continuing with checks\n"); | 656 | "Blacklist check succeeded, continuing with checks\n"); |
672 | #endif | ||
673 | bc->bl_pos = bc->bl_pos->next; | 657 | bc->bl_pos = bc->bl_pos->next; |
674 | bc->task = GNUNET_SCHEDULER_add_now (&do_blacklist_check, bc); | 658 | bc->task = GNUNET_SCHEDULER_add_now (&do_blacklist_check, bc); |
675 | } | 659 | } |
@@ -695,11 +679,9 @@ void | |||
695 | GST_blacklist_add_peer (const struct GNUNET_PeerIdentity *peer, | 679 | GST_blacklist_add_peer (const struct GNUNET_PeerIdentity *peer, |
696 | const char *transport_name) | 680 | const char *transport_name) |
697 | { | 681 | { |
698 | #if DEBUG_TRANSPORT | ||
699 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 682 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
700 | "Adding peer `%s' with plugin `%s' to blacklist\n", | 683 | "Adding peer `%s' with plugin `%s' to blacklist\n", |
701 | GNUNET_i2s (peer), transport_name); | 684 | GNUNET_i2s (peer), transport_name); |
702 | #endif | ||
703 | if (blacklist == NULL) | 685 | if (blacklist == NULL) |
704 | blacklist = | 686 | blacklist = |
705 | GNUNET_CONTAINER_multihashmap_create (TRANSPORT_BLACKLIST_HT_SIZE); | 687 | GNUNET_CONTAINER_multihashmap_create (TRANSPORT_BLACKLIST_HT_SIZE); |