changes required for arm fix
authorNathan S. Evans <evans@in.tum.de>
Thu, 6 May 2010 09:55:53 +0000 (09:55 +0000)
committerNathan S. Evans <evans@in.tum.de>
Thu, 6 May 2010 09:55:53 +0000 (09:55 +0000)
src/include/gnunet_client_lib.h
src/include/gnunet_connection_lib.h
src/include/gnunet_constants.h
src/include/gnunet_protocols.h
src/include/gnunet_server_lib.h

index 21487eb04d76dfa575d6b4fb65c7d00eb32df75d..56f6915a4ad4587fb601aca1095d5b565e1c16b9 100644 (file)
@@ -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);
 
 
 /**
index 0f6ae21e35b217ffa4bcb9b3df45042eb8083a79..9701eb1498c8d7d47854791bcbd87325550c01af 100644 (file)
@@ -84,6 +84,15 @@ typedef void (*GNUNET_CONNECTION_Receiver) (void *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
index bfb36a2ea1036d86c0f773780a24c1919714aa0a..b8e280d4eb3f51b49c41c84b39e7437edb605791 100644 (file)
@@ -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
index 501bf17ef7e8118d9175fc57a92952e889b7cb5c..069c6d5eea31a83a6eca5be16198aa76e9699aaa 100644 (file)
@@ -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.
index 351c0a7c149f74f4a6bf693696bf7f098bb7fef5..6d495c1c09fd8a92c07ee76db0a4f41d2191bb29 100644 (file)
@@ -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);
 
 
 /**