const struct
GNUNET_MessageHeader * msg);
+/**
+ * Type of a function to call when we have finished shutting
+ * down a service, or failed.
+ *
+ * @param cls closure
+ * @param reason what is the result of the shutdown
+ * GNUNET_NO on shutdown (not running)
+ * GNUNET_YES on running
+ * GNUNET_SYSERR on failure to transmit message
+ */
+typedef void (*GNUNET_CLIENT_ShutdownTask) (void *cls,
+ int reason);
+
/**
* Read from the service.
*
* be used by the caller after this call
* (calling this function frees "sock" after a while).
*
+ * @param sched the scheduler to use for calling shutdown continuation
* @param sock the socket connected to the service
+ * @param timeout how long to wait before giving up on transmission
+ * @param cont continuation to call once the service is really down
+ * @param cont_cls closure for continuation
+ *
*/
-void GNUNET_CLIENT_service_shutdown (struct GNUNET_CLIENT_Connection *sock);
+void
+GNUNET_CLIENT_service_shutdown (struct GNUNET_SCHEDULER_Handle *sched,
+ struct GNUNET_CLIENT_Connection *sock,
+ struct GNUNET_TIME_Relative timeout,
+ GNUNET_CLIENT_ShutdownTask cont,
+ void *cont_cls);
/**
const struct sockaddr * addr,\r
socklen_t addrlen, int errCode);\r
\r
+/**\r
+ * Set the persist option on this connection handle. Indicates\r
+ * that the underlying socket or fd should never really be closed.\r
+ * Used for indicating process death.\r
+ *\r
+ * @param sock the connection to set persistent
+ */\r
+void\r
+GNUNET_CONNECTION_persist_(struct GNUNET_CONNECTION_Handle *sock);\r
\r
/**\r
* Create a socket handle by boxing an existing OS socket. The OS\r
* How long do we wait after a FORK+EXEC before testing for the
* resulting process to be up (port open, waitpid, etc.)?
*/
-#define GNUNET_CONSTANTS_EXEC_WAIT GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_MILLISECONDS, 100)
+#define GNUNET_CONSTANTS_EXEC_WAIT GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_MILLISECONDS, 200)
/**
* After how long do we consider a service irresponsive
*/
#define GNUNET_MESSAGE_TYPE_ARM_IS_UNKNOWN 12
+/**
+ * Acknowledge service shutting down, disconnect
+ * indicates service stopped.
+ */
+#define GNUNET_MESSAGE_TYPE_SHUTDOWN_ACK 13
+
+/**
+ * Deny service shutdown, disconnect indicates
+ * service won't be stopped as a result of shutdown
+ * message.
+ */
+#define GNUNET_MESSAGE_TYPE_SHUTDOWN_REFUSE 14
/**
* HELLO message used for communicating peer addresses.
callback, void *callback_cls);
+/**
+ * Set the persistent flag on this client, used to setup client connection
+ * to only be killed when the service it's connected to is actually dead.
+ *
+ * @param client the client to set the persistent flag on
+ */
+void
+GNUNET_SERVER_client_persist_ (struct GNUNET_SERVER_Client *client);
+
/**
* Resume receiving from this client, we are done processing the
* current request. This function must be called from within each
* Destroy this connection (free resources).
*
* @param cls closure
+ * @pararm persist when connection is closed, "leak" socket
*/
-typedef void (*GNUNET_SERVER_DestroyCallback) (void *cls);
+typedef void (*GNUNET_SERVER_DestroyCallback) (void *cls, int persist);
/**