diff options
author | Christian Grothoff <christian@grothoff.org> | 2012-04-22 19:52:39 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2012-04-22 19:52:39 +0000 |
commit | e2bf225a32bb93731b574ad698f20acbb92a5803 (patch) | |
tree | dc151b39eb6bb96eaa03c447a92205e8c4254b58 /src/include/gnunet_service_lib.h | |
parent | 9ba0af50e8f41d40163bbac21003261928084c48 (diff) | |
download | gnunet-e2bf225a32bb93731b574ad698f20acbb92a5803.tar.gz gnunet-e2bf225a32bb93731b574ad698f20acbb92a5803.zip |
introducing soft shutdown concept for services; during soft shutdown, services that are still managing non-monitor clients continue to run until those clients disconnect; however, the services do stop to accept new connections (will stop listening); soft shutdown is now used by ats, transport, peerinfo, namestore and most importantly statistics; this should fix #2197
Diffstat (limited to 'src/include/gnunet_service_lib.h')
-rw-r--r-- | src/include/gnunet_service_lib.h | 38 |
1 files changed, 23 insertions, 15 deletions
diff --git a/src/include/gnunet_service_lib.h b/src/include/gnunet_service_lib.h index 1641e0f93..ec0c15e1b 100644 --- a/src/include/gnunet_service_lib.h +++ b/src/include/gnunet_service_lib.h | |||
@@ -85,16 +85,22 @@ typedef void (*GNUNET_SERVICE_Main) (void *cls, | |||
85 | */ | 85 | */ |
86 | enum GNUNET_SERVICE_Options | 86 | enum GNUNET_SERVICE_Options |
87 | { | 87 | { |
88 | /** | 88 | /** |
89 | * Use defaults. | 89 | * Use defaults. |
90 | */ | 90 | */ |
91 | GNUNET_SERVICE_OPTION_NONE = 0, | 91 | GNUNET_SERVICE_OPTION_NONE = 0, |
92 | 92 | ||
93 | /** | 93 | /** |
94 | * Do not trigger server shutdown on signals, allow for the user | 94 | * Do not trigger server shutdown on signals, allow for the user |
95 | * to terminate the server explicitly when needed. | 95 | * to terminate the server explicitly when needed. |
96 | */ | 96 | */ |
97 | GNUNET_SERVICE_OPTION_MANUAL_SHUTDOWN = 1 | 97 | GNUNET_SERVICE_OPTION_MANUAL_SHUTDOWN = 1, |
98 | |||
99 | /** | ||
100 | * Trigger a SOFT server shutdown on signals, allowing active | ||
101 | * non-monitor clients to complete their transactions. | ||
102 | */ | ||
103 | GNUNET_SERVICE_OPTION_SOFT_SHUTDOWN = 2 | ||
98 | }; | 104 | }; |
99 | 105 | ||
100 | 106 | ||
@@ -104,16 +110,16 @@ enum GNUNET_SERVICE_Options | |||
104 | * | 110 | * |
105 | * @param argc number of command line arguments | 111 | * @param argc number of command line arguments |
106 | * @param argv command line arguments | 112 | * @param argv command line arguments |
107 | * @param serviceName our service name | 113 | * @param service_name our service name |
108 | * @param opt service options | 114 | * @param options service options |
109 | * @param task main task of the service | 115 | * @param task main task of the service |
110 | * @param task_cls closure for task | 116 | * @param task_cls closure for task |
111 | * @return GNUNET_SYSERR on error, GNUNET_OK | 117 | * @return GNUNET_SYSERR on error, GNUNET_OK |
112 | * if we shutdown nicely | 118 | * if we shutdown nicely |
113 | */ | 119 | */ |
114 | int | 120 | int |
115 | GNUNET_SERVICE_run (int argc, char *const *argv, const char *serviceName, | 121 | GNUNET_SERVICE_run (int argc, char *const *argv, const char *service_name, |
116 | enum GNUNET_SERVICE_Options opt, GNUNET_SERVICE_Main task, | 122 | enum GNUNET_SERVICE_Options options, GNUNET_SERVICE_Main task, |
117 | void *task_cls); | 123 | void *task_cls); |
118 | 124 | ||
119 | 125 | ||
@@ -123,13 +129,15 @@ struct GNUNET_SERVICE_Context; | |||
123 | * Run a service startup sequence within an existing | 129 | * Run a service startup sequence within an existing |
124 | * initialized system. | 130 | * initialized system. |
125 | * | 131 | * |
126 | * @param serviceName our service name | 132 | * @param service_name our service name |
127 | * @param cfg configuration to use | 133 | * @param cfg configuration to use |
134 | * @param options service options | ||
128 | * @return NULL on error, service handle | 135 | * @return NULL on error, service handle |
129 | */ | 136 | */ |
130 | struct GNUNET_SERVICE_Context * | 137 | struct GNUNET_SERVICE_Context * |
131 | GNUNET_SERVICE_start (const char *serviceName, | 138 | GNUNET_SERVICE_start (const char *service_name, |
132 | const struct GNUNET_CONFIGURATION_Handle *cfg); | 139 | const struct GNUNET_CONFIGURATION_Handle *cfg, |
140 | enum GNUNET_SERVICE_Options options); | ||
133 | 141 | ||
134 | 142 | ||
135 | /** | 143 | /** |