void GNUNET_SERVER_client_disconnect (struct GNUNET_SERVER_Client *client);
+/**
+ * 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
*/
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;
+
};
*/
GNUNET_SERVER_TransmitReadyCallback notify_transmit_ready;
- /**
+ /**
* Callback to ask about transmit-ready notification.
*/
GNUNET_SERVER_TransmitReadyCancelCallback notify_transmit_ready_cancel;
/**
* 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,
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,
&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));
"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);
}
}
+/**
+ * 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 */