aboutsummaryrefslogtreecommitdiff
path: root/src/util/server.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/util/server.c')
-rw-r--r--src/util/server.c30
1 files changed, 12 insertions, 18 deletions
diff --git a/src/util/server.c b/src/util/server.c
index 8dedd28fd..00e37c9d9 100644
--- a/src/util/server.c
+++ b/src/util/server.c
@@ -400,12 +400,6 @@ process_listen_socket (void *cls)
400 400
401 server->listen_task = NULL; 401 server->listen_task = NULL;
402 tc = GNUNET_SCHEDULER_get_task_context (); 402 tc = GNUNET_SCHEDULER_get_task_context ();
403 if (0 != (tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN))
404 {
405 /* ignore shutdown, someone else will take care of it! */
406 GNUNET_SERVER_resume (server);
407 return;
408 }
409 for (i = 0; NULL != server->listen_sockets[i]; i++) 403 for (i = 0; NULL != server->listen_sockets[i]; i++)
410 { 404 {
411 if (GNUNET_NETWORK_fdset_isset (tc->read_ready, 405 if (GNUNET_NETWORK_fdset_isset (tc->read_ready,
@@ -437,7 +431,8 @@ process_listen_socket (void *cls)
437 * @return NULL on error, otherwise the listen socket 431 * @return NULL on error, otherwise the listen socket
438 */ 432 */
439static struct GNUNET_NETWORK_Handle * 433static struct GNUNET_NETWORK_Handle *
440open_listen_socket (const struct sockaddr *server_addr, socklen_t socklen) 434open_listen_socket (const struct sockaddr *server_addr,
435 socklen_t socklen)
441{ 436{
442 struct GNUNET_NETWORK_Handle *sock; 437 struct GNUNET_NETWORK_Handle *sock;
443 uint16_t port; 438 uint16_t port;
@@ -683,7 +678,7 @@ test_monitor_clients (struct GNUNET_SERVER_Handle *server)
683 if (GNUNET_NO == client->is_monitor) 678 if (GNUNET_NO == client->is_monitor)
684 return; /* not done yet */ 679 return; /* not done yet */
685 server->in_soft_shutdown = GNUNET_SYSERR; 680 server->in_soft_shutdown = GNUNET_SYSERR;
686 GNUNET_SCHEDULER_add_now (&do_destroy, server); 681 (void) GNUNET_SCHEDULER_add_now (&do_destroy, server);
687} 682}
688 683
689 684
@@ -720,8 +715,8 @@ GNUNET_SERVER_resume (struct GNUNET_SERVER_Handle *server)
720 return; /* nothing to do, no listen sockets! */ 715 return; /* nothing to do, no listen sockets! */
721 if (NULL == server->listen_sockets[1]) 716 if (NULL == server->listen_sockets[1])
722 { 717 {
723 /* simplified method: no fd set needed; this is then much simpler and 718 /* simplified method: no fd set needed; this is then much simpler
724 much more efficient */ 719 and much more efficient */
725 server->listen_task = 720 server->listen_task =
726 GNUNET_SCHEDULER_add_read_net_with_priority (GNUNET_TIME_UNIT_FOREVER_REL, 721 GNUNET_SCHEDULER_add_read_net_with_priority (GNUNET_TIME_UNIT_FOREVER_REL,
727 GNUNET_SCHEDULER_PRIORITY_HIGH, 722 GNUNET_SCHEDULER_PRIORITY_HIGH,
@@ -890,18 +885,16 @@ static void
890warn_no_receive_done (void *cls) 885warn_no_receive_done (void *cls)
891{ 886{
892 struct GNUNET_SERVER_Client *client = cls; 887 struct GNUNET_SERVER_Client *client = cls;
893 const struct GNUNET_SCHEDULER_TaskContext *tc;
894 888
895 GNUNET_break (0 != client->warn_type); /* type should never be 0 here, as we don't use 0 */ 889 GNUNET_break (0 != client->warn_type); /* type should never be 0 here, as we don't use 0 */
896 client->warn_task = 890 client->warn_task =
897 GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_MINUTES, 891 GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_MINUTES,
898 &warn_no_receive_done, client); 892 &warn_no_receive_done, client);
899 tc = GNUNET_SCHEDULER_get_task_context (); 893 LOG (GNUNET_ERROR_TYPE_WARNING,
900 if (0 == (GNUNET_SCHEDULER_REASON_SHUTDOWN & tc->reason)) 894 _("Processing code for message of type %u did not call `GNUNET_SERVER_receive_done' after %s\n"),
901 LOG (GNUNET_ERROR_TYPE_WARNING, 895 (unsigned int) client->warn_type,
902 _("Processing code for message of type %u did not call `GNUNET_SERVER_receive_done' after %s\n"), 896 GNUNET_STRINGS_relative_time_to_string (GNUNET_TIME_absolute_get_duration (client->warn_start),
903 (unsigned int) client->warn_type, 897 GNUNET_YES));
904 GNUNET_STRINGS_relative_time_to_string (GNUNET_TIME_absolute_get_duration (client->warn_start), GNUNET_YES));
905} 898}
906 899
907 900
@@ -987,7 +980,8 @@ GNUNET_SERVER_inject (struct GNUNET_SERVER_Handle *server,
987 sender->warn_start = GNUNET_TIME_absolute_get (); 980 sender->warn_start = GNUNET_TIME_absolute_get ();
988 sender->warn_task = 981 sender->warn_task =
989 GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_MINUTES, 982 GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_MINUTES,
990 &warn_no_receive_done, sender); 983 &warn_no_receive_done,
984 sender);
991 sender->warn_type = type; 985 sender->warn_type = type;
992 } 986 }
993 sender->suspended++; 987 sender->suspended++;