From: Nathan S. Evans Date: Thu, 6 May 2010 09:55:53 +0000 (+0000) Subject: changes required for arm fix X-Git-Tag: initial-import-from-subversion-38251~21862 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=998cb5efab59bfc5cdf9b324273b367fa8278c0b;p=oweals%2Fgnunet.git changes required for arm fix --- diff --git a/src/include/gnunet_client_lib.h b/src/include/gnunet_client_lib.h index 21487eb04..56f6915a4 100644 --- a/src/include/gnunet_client_lib.h +++ b/src/include/gnunet_client_lib.h @@ -105,6 +105,19 @@ typedef void (*GNUNET_CLIENT_MessageHandler) (void *cls, 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. * @@ -202,9 +215,19 @@ GNUNET_CLIENT_transmit_and_get_response (struct GNUNET_CLIENT_Connection *sock, * 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); /** diff --git a/src/include/gnunet_connection_lib.h b/src/include/gnunet_connection_lib.h index 0f6ae21e3..9701eb149 100644 --- a/src/include/gnunet_connection_lib.h +++ b/src/include/gnunet_connection_lib.h @@ -84,6 +84,15 @@ typedef void (*GNUNET_CONNECTION_Receiver) (void *cls, const struct sockaddr * addr, socklen_t addrlen, int errCode); +/** + * Set the persist option on this connection handle. Indicates + * that the underlying socket or fd should never really be closed. + * Used for indicating process death. + * + * @param sock the connection to set persistent + */ +void +GNUNET_CONNECTION_persist_(struct GNUNET_CONNECTION_Handle *sock); /** * Create a socket handle by boxing an existing OS socket. The OS diff --git a/src/include/gnunet_constants.h b/src/include/gnunet_constants.h index bfb36a2ea..b8e280d4e 100644 --- a/src/include/gnunet_constants.h +++ b/src/include/gnunet_constants.h @@ -60,7 +60,7 @@ extern "C" * 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 diff --git a/src/include/gnunet_protocols.h b/src/include/gnunet_protocols.h index 501bf17ef..069c6d5ee 100644 --- a/src/include/gnunet_protocols.h +++ b/src/include/gnunet_protocols.h @@ -104,6 +104,18 @@ extern "C" */ #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. diff --git a/src/include/gnunet_server_lib.h b/src/include/gnunet_server_lib.h index 351c0a7c1..6d495c1c0 100644 --- a/src/include/gnunet_server_lib.h +++ b/src/include/gnunet_server_lib.h @@ -186,6 +186,15 @@ struct GNUNET_CONNECTION_TransmitHandle 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 @@ -317,8 +326,9 @@ typedef int (*GNUNET_SERVER_CheckCallback) (void *cls); * 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); /**