diff options
author | Christian Grothoff <christian@grothoff.org> | 2017-03-17 18:13:55 +0100 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2017-03-17 18:13:55 +0100 |
commit | 17d34d5e094c2f8a90717b07e3a711d6e2c15903 (patch) | |
tree | 777b5323145a5f4d1f044da29a682799008a11d4 /src/transport/plugin_transport_tcp.c | |
parent | 3391977e3f92a2ebcafc14ea6374aecd580df873 (diff) | |
download | gnunet-17d34d5e094c2f8a90717b07e3a711d6e2c15903.tar.gz gnunet-17d34d5e094c2f8a90717b07e3a711d6e2c15903.zip |
more renamings relating to 'new' service now just being the 'normal' service
Diffstat (limited to 'src/transport/plugin_transport_tcp.c')
-rw-r--r-- | src/transport/plugin_transport_tcp.c | 61 |
1 files changed, 52 insertions, 9 deletions
diff --git a/src/transport/plugin_transport_tcp.c b/src/transport/plugin_transport_tcp.c index 10ea01cec..a63013caa 100644 --- a/src/transport/plugin_transport_tcp.c +++ b/src/transport/plugin_transport_tcp.c | |||
@@ -71,6 +71,21 @@ struct GNUNET_SERVER_TransmitHandle; | |||
71 | */ | 71 | */ |
72 | struct GNUNET_CONNECTION_Handle; | 72 | struct GNUNET_CONNECTION_Handle; |
73 | 73 | ||
74 | /** | ||
75 | * @brief handle for a network service | ||
76 | */ | ||
77 | struct LEGACY_SERVICE_Context; | ||
78 | |||
79 | |||
80 | /** | ||
81 | * Stops a service that was started with #GNUNET_SERVICE_start(). | ||
82 | * | ||
83 | * @param srv service to stop | ||
84 | */ | ||
85 | void | ||
86 | LEGACY_SERVICE_stop (struct LEGACY_SERVICE_Context *srv); | ||
87 | |||
88 | |||
74 | 89 | ||
75 | /** | 90 | /** |
76 | * Function called to notify a client about the connection begin ready | 91 | * Function called to notify a client about the connection begin ready |
@@ -269,6 +284,34 @@ struct GNUNET_SERVER_MessageHandler | |||
269 | 284 | ||
270 | }; | 285 | }; |
271 | 286 | ||
287 | |||
288 | /** | ||
289 | * Options for the service (bitmask). | ||
290 | */ | ||
291 | enum LEGACY_SERVICE_Options | ||
292 | { | ||
293 | /** | ||
294 | * Use defaults. Terminates all client connections and the listen | ||
295 | * sockets immediately upon receiving the shutdown signal. | ||
296 | */ | ||
297 | LEGACY_SERVICE_OPTION_NONE = 0, | ||
298 | |||
299 | /** | ||
300 | * Do not trigger server shutdown on signal at all; instead, allow | ||
301 | * for the user to terminate the server explicitly when needed | ||
302 | * by calling #LEGACY_SERVICE_shutdown(). | ||
303 | */ | ||
304 | LEGACY_SERVICE_OPTION_MANUAL_SHUTDOWN = 1, | ||
305 | |||
306 | /** | ||
307 | * Trigger a SOFT server shutdown on signals, allowing active | ||
308 | * non-monitor clients to complete their transactions. | ||
309 | */ | ||
310 | LEGACY_SERVICE_OPTION_SOFT_SHUTDOWN = 2 | ||
311 | }; | ||
312 | |||
313 | |||
314 | |||
272 | /** | 315 | /** |
273 | * Ask the server to disconnect from the given client. This is the | 316 | * Ask the server to disconnect from the given client. This is the |
274 | * same as passing #GNUNET_SYSERR to #GNUNET_SERVER_receive_done, | 317 | * same as passing #GNUNET_SYSERR to #GNUNET_SERVER_receive_done, |
@@ -453,7 +496,7 @@ GNUNET_SERVER_client_drop (struct GNUNET_SERVER_Client *client); | |||
453 | * @param cfg configuration to use | 496 | * @param cfg configuration to use |
454 | */ | 497 | */ |
455 | typedef void | 498 | typedef void |
456 | (*GNUNET_SERVICE_Main) (void *cls, | 499 | (*LEGACY_SERVICE_Main) (void *cls, |
457 | struct GNUNET_SERVER_Handle *server, | 500 | struct GNUNET_SERVER_Handle *server, |
458 | const struct GNUNET_CONFIGURATION_Handle *cfg); | 501 | const struct GNUNET_CONFIGURATION_Handle *cfg); |
459 | 502 | ||
@@ -919,7 +962,7 @@ struct Plugin | |||
919 | /** | 962 | /** |
920 | * Handle to the network service. | 963 | * Handle to the network service. |
921 | */ | 964 | */ |
922 | struct GNUNET_SERVICE_Context *service; | 965 | struct LEGACY_SERVICE_Context *service; |
923 | 966 | ||
924 | /** | 967 | /** |
925 | * Handle to the server for this service. | 968 | * Handle to the server for this service. |
@@ -3733,7 +3776,7 @@ libgnunet_plugin_transport_tcp_init (void *cls) | |||
3733 | struct GNUNET_TRANSPORT_PluginEnvironment *env = cls; | 3776 | struct GNUNET_TRANSPORT_PluginEnvironment *env = cls; |
3734 | struct GNUNET_TRANSPORT_PluginFunctions *api; | 3777 | struct GNUNET_TRANSPORT_PluginFunctions *api; |
3735 | struct Plugin *plugin; | 3778 | struct Plugin *plugin; |
3736 | struct GNUNET_SERVICE_Context *service; | 3779 | struct LEGACY_SERVICE_Context *service; |
3737 | unsigned long long aport; | 3780 | unsigned long long aport; |
3738 | unsigned long long bport; | 3781 | unsigned long long bport; |
3739 | unsigned long long max_connections; | 3782 | unsigned long long max_connections; |
@@ -3788,9 +3831,9 @@ libgnunet_plugin_transport_tcp_init (void *cls) | |||
3788 | aport = 0; | 3831 | aport = 0; |
3789 | if (0 != bport) | 3832 | if (0 != bport) |
3790 | { | 3833 | { |
3791 | service = GNUNET_SERVICE_start ("transport-tcp", | 3834 | service = LEGACY_SERVICE_start ("transport-tcp", |
3792 | env->cfg, | 3835 | env->cfg, |
3793 | GNUNET_SERVICE_OPTION_NONE); | 3836 | LEGACY_SERVICE_OPTION_NONE); |
3794 | if (NULL == service) | 3837 | if (NULL == service) |
3795 | { | 3838 | { |
3796 | LOG (GNUNET_ERROR_TYPE_WARNING, | 3839 | LOG (GNUNET_ERROR_TYPE_WARNING, |
@@ -3821,7 +3864,7 @@ libgnunet_plugin_transport_tcp_init (void *cls) | |||
3821 | { | 3864 | { |
3822 | #ifdef TCP_STEALTH | 3865 | #ifdef TCP_STEALTH |
3823 | plugin->myoptions |= TCP_OPTIONS_TCP_STEALTH; | 3866 | plugin->myoptions |= TCP_OPTIONS_TCP_STEALTH; |
3824 | lsocks = GNUNET_SERVICE_get_listen_sockets (service); | 3867 | lsocks = LEGACY_SERVICE_get_listen_sockets (service); |
3825 | if (NULL != lsocks) | 3868 | if (NULL != lsocks) |
3826 | { | 3869 | { |
3827 | uint32_t len = sizeof (struct WelcomeMessage); | 3870 | uint32_t len = sizeof (struct WelcomeMessage); |
@@ -3914,7 +3957,7 @@ libgnunet_plugin_transport_tcp_init (void *cls) | |||
3914 | plugin->service = service; | 3957 | plugin->service = service; |
3915 | if (NULL != service) | 3958 | if (NULL != service) |
3916 | { | 3959 | { |
3917 | plugin->server = GNUNET_SERVICE_get_server (service); | 3960 | plugin->server = LEGACY_SERVICE_get_server (service); |
3918 | } | 3961 | } |
3919 | else | 3962 | else |
3920 | { | 3963 | { |
@@ -3977,7 +4020,7 @@ libgnunet_plugin_transport_tcp_init (void *cls) | |||
3977 | GNUNET_NAT_unregister (plugin->nat); | 4020 | GNUNET_NAT_unregister (plugin->nat); |
3978 | GNUNET_CONTAINER_multipeermap_destroy (plugin->sessionmap); | 4021 | GNUNET_CONTAINER_multipeermap_destroy (plugin->sessionmap); |
3979 | if (NULL != service) | 4022 | if (NULL != service) |
3980 | GNUNET_SERVICE_stop (service); | 4023 | LEGACY_SERVICE_stop (service); |
3981 | GNUNET_free (plugin); | 4024 | GNUNET_free (plugin); |
3982 | GNUNET_free_non_null (api); | 4025 | GNUNET_free_non_null (api); |
3983 | return NULL; | 4026 | return NULL; |
@@ -4030,7 +4073,7 @@ libgnunet_plugin_transport_tcp_done (void *cls) | |||
4030 | } | 4073 | } |
4031 | 4074 | ||
4032 | if (NULL != plugin->service) | 4075 | if (NULL != plugin->service) |
4033 | GNUNET_SERVICE_stop (plugin->service); | 4076 | LEGACY_SERVICE_stop (plugin->service); |
4034 | else | 4077 | else |
4035 | GNUNET_SERVER_destroy (plugin->server); | 4078 | GNUNET_SERVER_destroy (plugin->server); |
4036 | GNUNET_free (plugin->handlers); | 4079 | GNUNET_free (plugin->handlers); |