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_clients.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_clients.c')
-rw-r--r-- | src/transport/gnunet-service-transport_clients.c | 19 |
1 files changed, 0 insertions, 19 deletions
diff --git a/src/transport/gnunet-service-transport_clients.c b/src/transport/gnunet-service-transport_clients.c index f430ef91a..939f57b10 100644 --- a/src/transport/gnunet-service-transport_clients.c +++ b/src/transport/gnunet-service-transport_clients.c | |||
@@ -208,10 +208,7 @@ setup_client (struct GNUNET_SERVER_Client *client) | |||
208 | GNUNET_assert (lookup_client (client) == NULL); | 208 | GNUNET_assert (lookup_client (client) == NULL); |
209 | tc = GNUNET_malloc (sizeof (struct TransportClient)); | 209 | tc = GNUNET_malloc (sizeof (struct TransportClient)); |
210 | tc->client = client; | 210 | tc->client = client; |
211 | |||
212 | #if DEBUG_TRANSPORT | ||
213 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Client %p connected\n", tc); | 211 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Client %p connected\n", tc); |
214 | #endif | ||
215 | return tc; | 212 | return tc; |
216 | } | 213 | } |
217 | 214 | ||
@@ -293,10 +290,8 @@ transmit_to_client_callback (void *cls, size_t size, void *buf) | |||
293 | tc->th = NULL; | 290 | tc->th = NULL; |
294 | if (buf == NULL) | 291 | if (buf == NULL) |
295 | { | 292 | { |
296 | #if DEBUG_TRANSPORT | ||
297 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 293 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
298 | "Transmission to client failed, closing connection.\n"); | 294 | "Transmission to client failed, closing connection.\n"); |
299 | #endif | ||
300 | return 0; | 295 | return 0; |
301 | } | 296 | } |
302 | cbuf = buf; | 297 | cbuf = buf; |
@@ -307,11 +302,9 @@ transmit_to_client_callback (void *cls, size_t size, void *buf) | |||
307 | msize = ntohs (msg->size); | 302 | msize = ntohs (msg->size); |
308 | if (msize + tsize > size) | 303 | if (msize + tsize > size) |
309 | break; | 304 | break; |
310 | #if DEBUG_TRANSPORT | ||
311 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 305 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
312 | "Transmitting message of type %u to client %p.\n", | 306 | "Transmitting message of type %u to client %p.\n", |
313 | ntohs (msg->type), tc); | 307 | ntohs (msg->type), tc); |
314 | #endif | ||
315 | GNUNET_CONTAINER_DLL_remove (tc->message_queue_head, tc->message_queue_tail, | 308 | GNUNET_CONTAINER_DLL_remove (tc->message_queue_head, tc->message_queue_tail, |
316 | q); | 309 | q); |
317 | tc->message_count--; | 310 | tc->message_count--; |
@@ -403,10 +396,8 @@ client_disconnect_notification (void *cls, struct GNUNET_SERVER_Client *client) | |||
403 | tc = lookup_client (client); | 396 | tc = lookup_client (client); |
404 | if (tc == NULL) | 397 | if (tc == NULL) |
405 | return; | 398 | return; |
406 | #if DEBUG_TRANSPORT | ||
407 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG | GNUNET_ERROR_TYPE_BULK, | 399 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG | GNUNET_ERROR_TYPE_BULK, |
408 | "Client %p disconnected, cleaning up.\n", tc); | 400 | "Client %p disconnected, cleaning up.\n", tc); |
409 | #endif | ||
410 | while (NULL != (mqe = tc->message_queue_head)) | 401 | while (NULL != (mqe = tc->message_queue_head)) |
411 | { | 402 | { |
412 | GNUNET_CONTAINER_DLL_remove (tc->message_queue_head, tc->message_queue_tail, | 403 | GNUNET_CONTAINER_DLL_remove (tc->message_queue_head, tc->message_queue_tail, |
@@ -481,18 +472,14 @@ clients_handle_start (void *cls, struct GNUNET_SERVER_Client *client, | |||
481 | 472 | ||
482 | tc = lookup_client (client); | 473 | tc = lookup_client (client); |
483 | 474 | ||
484 | #if DEBUG_TRANSPORT | ||
485 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG | GNUNET_ERROR_TYPE_BULK, | 475 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG | GNUNET_ERROR_TYPE_BULK, |
486 | "Client %p sent START\n", tc); | 476 | "Client %p sent START\n", tc); |
487 | #endif | ||
488 | if (tc != NULL) | 477 | if (tc != NULL) |
489 | { | 478 | { |
490 | /* got 'start' twice from the same client, not allowed */ | 479 | /* got 'start' twice from the same client, not allowed */ |
491 | #if DEBUG_TRANSPORT | ||
492 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG | GNUNET_ERROR_TYPE_BULK, | 480 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG | GNUNET_ERROR_TYPE_BULK, |
493 | "TransportClient %p ServerClient %p sent multiple START messages\n", | 481 | "TransportClient %p ServerClient %p sent multiple START messages\n", |
494 | tc, tc->client); | 482 | tc, tc->client); |
495 | #endif | ||
496 | GNUNET_break (0); | 483 | GNUNET_break (0); |
497 | GNUNET_SERVER_receive_done (client, GNUNET_SYSERR); | 484 | GNUNET_SERVER_receive_done (client, GNUNET_SYSERR); |
498 | return; | 485 | return; |
@@ -627,19 +614,15 @@ clients_handle_send (void *cls, struct GNUNET_SERVER_Client *client, | |||
627 | gettext_noop | 614 | gettext_noop |
628 | ("# bytes payload received for other peers"), msize, | 615 | ("# bytes payload received for other peers"), msize, |
629 | GNUNET_NO); | 616 | GNUNET_NO); |
630 | #if DEBUG_TRANSPORT | ||
631 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 617 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
632 | "Received `%s' request from client with target `%4s' and first message of type %u and total size %u\n", | 618 | "Received `%s' request from client with target `%4s' and first message of type %u and total size %u\n", |
633 | "SEND", GNUNET_i2s (&obm->peer), ntohs (obmm->type), msize); | 619 | "SEND", GNUNET_i2s (&obm->peer), ntohs (obmm->type), msize); |
634 | #endif | ||
635 | if (GNUNET_NO == GST_neighbours_test_connected (&obm->peer)) | 620 | if (GNUNET_NO == GST_neighbours_test_connected (&obm->peer)) |
636 | { | 621 | { |
637 | /* not connected, not allowed to send; can happen due to asynchronous operations */ | 622 | /* not connected, not allowed to send; can happen due to asynchronous operations */ |
638 | #if DEBUG_TRANSPORT | ||
639 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 623 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
640 | "Could not send message to peer `%s': not connected\n", | 624 | "Could not send message to peer `%s': not connected\n", |
641 | GNUNET_i2s (&obm->peer)); | 625 | GNUNET_i2s (&obm->peer)); |
642 | #endif | ||
643 | GNUNET_STATISTICS_update (GST_stats, | 626 | GNUNET_STATISTICS_update (GST_stats, |
644 | gettext_noop | 627 | gettext_noop |
645 | ("# bytes payload dropped (other peer was not connected)"), | 628 | ("# bytes payload dropped (other peer was not connected)"), |
@@ -695,11 +678,9 @@ clients_handle_request_connect (void *cls, struct GNUNET_SERVER_Client *client, | |||
695 | gettext_noop | 678 | gettext_noop |
696 | ("# REQUEST CONNECT messages received"), 1, | 679 | ("# REQUEST CONNECT messages received"), 1, |
697 | GNUNET_NO); | 680 | GNUNET_NO); |
698 | #if DEBUG_TRANSPORT | ||
699 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 681 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
700 | "Received a request connect message for peer `%s'\n", | 682 | "Received a request connect message for peer `%s'\n", |
701 | GNUNET_i2s (&trcm->peer)); | 683 | GNUNET_i2s (&trcm->peer)); |
702 | #endif | ||
703 | (void) GST_blacklist_test_allowed (&trcm->peer, NULL, &try_connect_if_allowed, | 684 | (void) GST_blacklist_test_allowed (&trcm->peer, NULL, &try_connect_if_allowed, |
704 | NULL); | 685 | NULL); |
705 | GNUNET_SERVER_receive_done (client, GNUNET_OK); | 686 | GNUNET_SERVER_receive_done (client, GNUNET_OK); |