[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r9519 - in gnunet/src: include util
From: |
gnunet |
Subject: |
[GNUnet-SVN] r9519 - in gnunet/src: include util |
Date: |
Sun, 15 Nov 2009 10:57:04 -0700 |
Author: grothoff
Date: 2009-11-15 10:57:03 -0700 (Sun, 15 Nov 2009)
New Revision: 9519
Modified:
gnunet/src/include/gnunet_server_lib.h
gnunet/src/util/server.c
Log:
add shutdown-ignore option to server
Modified: gnunet/src/include/gnunet_server_lib.h
===================================================================
--- gnunet/src/include/gnunet_server_lib.h 2009-11-15 17:45:26 UTC (rev
9518)
+++ gnunet/src/include/gnunet_server_lib.h 2009-11-15 17:57:03 UTC (rev
9519)
@@ -427,6 +427,22 @@
/**
+ * Configure this server's connections to continue handling client
+ * requests as usual even after we get a shutdown signal. The change
+ * only applies to clients that connect to the server from the outside
+ * using TCP after this call. Clients managed previously or those
+ * added using GNUNET_SERVER_connect_socket and
+ * GNUNET_SERVER_connect_callback are not affected by this option.
+ *
+ * @param h server handle
+ * @param do_ignore GNUNET_YES to ignore, GNUNET_NO to restore default
+ */
+void
+GNUNET_SERVER_ignore_shutdown (struct GNUNET_SERVER_Handle *h,
+ int do_ignore);
+
+
+/**
* The tansmit context is the key datastructure for a conveniance API
* used for transmission of complex results to the client followed
* ONLY by signaling receive_done with success or error
Modified: gnunet/src/util/server.c
===================================================================
--- gnunet/src/util/server.c 2009-11-15 17:45:26 UTC (rev 9518)
+++ gnunet/src/util/server.c 2009-11-15 17:57:03 UTC (rev 9519)
@@ -140,6 +140,14 @@
*/
int require_found;
+ /**
+ * Should all of the clients of this server continue
+ * to process connections as usual even if we get
+ * a shutdown request? (the listen socket always ignores
+ * shutdown).
+ */
+ int clients_ignore_shutdown;
+
};
@@ -185,7 +193,7 @@
*/
GNUNET_SERVER_TransmitReadyCallback notify_transmit_ready;
- /**
+ /**
* Callback to ask about transmit-ready notification.
*/
GNUNET_SERVER_TransmitReadyCancelCallback notify_transmit_ready_cancel;
@@ -259,6 +267,10 @@
/**
* Scheduler says our listen socket is ready.
* Process it!
+ *
+ * @param cls handle to our server for which we are processing the listen
+ * socket
+ * @param tc reason why we are running right now
*/
static void
process_listen_socket (void *cls,
@@ -274,6 +286,7 @@
GNUNET_NETWORK_fdset_set (r, server->listen_socket);
if (0 != (tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN))
{
+ /* ignore shutdown, someone else will take care of it! */
server->listen_task = GNUNET_SCHEDULER_add_select (server->sched,
GNUNET_SCHEDULER_PRIORITY_HIGH,
GNUNET_SCHEDULER_NO_TASK,
@@ -282,7 +295,7 @@
&process_listen_socket,
server);
GNUNET_NETWORK_fdset_destroy (r);
- return; /* ignore shutdown, someone else will take
care of it! */
+ return;
}
GNUNET_assert (GNUNET_NETWORK_fdset_isset
(tc->read_ready, server->listen_socket));
@@ -298,7 +311,7 @@
"Server accepted incoming connection.\n");
#endif
client = GNUNET_SERVER_connect_socket (server, sock);
- // GNUNET_CONNECTION_ignore_shutdown (sock, GNUNET_YES);
+ GNUNET_CONNECTION_ignore_shutdown (sock,
server->clients_ignore_shutdown);
/* decrement reference count, we don't keep "client" alive */
GNUNET_SERVER_client_drop (client);
}
@@ -1146,4 +1159,22 @@
}
+/**
+ * Configure this server's connections to continue handling client
+ * requests as usual even after we get a shutdown signal. The change
+ * only applies to clients that connect to the server from the outside
+ * using TCP after this call. Clients managed previously or those
+ * added using GNUNET_SERVER_connect_socket and
+ * GNUNET_SERVER_connect_callback are not affected by this option.
+ *
+ * @param h server handle
+ * @param do_ignore GNUNET_YES to ignore, GNUNET_NO to restore default
+ */
+void
+GNUNET_SERVER_ignore_shutdown (struct GNUNET_SERVER_Handle *h,
+ int do_ignore)
+{
+ h->clients_ignore_shutdown = do_ignore;
+}
+
/* end of server.c */
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r9519 - in gnunet/src: include util,
gnunet <=