diff options
author | Christian Grothoff <christian@grothoff.org> | 2015-01-22 23:04:40 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2015-01-22 23:04:40 +0000 |
commit | a57305cef1ec471aea627810955e6f6cec36d847 (patch) | |
tree | 475a79a451277b60033a9919fb2499c197cc77ab /src/ats/gnunet-service-ats.c | |
parent | 78b8e1c2a54c44992a16b65cdf67fea973e2cad0 (diff) | |
download | gnunet-a57305cef1ec471aea627810955e6f6cec36d847.tar.gz gnunet-a57305cef1ec471aea627810955e6f6cec36d847.zip |
use statics instead of singleton struct, simplify internal APIs
Diffstat (limited to 'src/ats/gnunet-service-ats.c')
-rw-r--r-- | src/ats/gnunet-service-ats.c | 24 |
1 files changed, 15 insertions, 9 deletions
diff --git a/src/ats/gnunet-service-ats.c b/src/ats/gnunet-service-ats.c index 44bb1cebc..edc3b51af 100644 --- a/src/ats/gnunet-service-ats.c +++ b/src/ats/gnunet-service-ats.c | |||
@@ -43,11 +43,6 @@ struct GNUNET_STATISTICS_Handle *GSA_stats; | |||
43 | */ | 43 | */ |
44 | static struct GNUNET_SERVER_Handle *GSA_server; | 44 | static struct GNUNET_SERVER_Handle *GSA_server; |
45 | 45 | ||
46 | /** | ||
47 | * Handle to the address state. | ||
48 | */ | ||
49 | static struct GAS_Addresses_Handle *GSA_addresses; | ||
50 | |||
51 | 46 | ||
52 | /** | 47 | /** |
53 | * We have received a `struct ClientStartMessage` from a client. Find | 48 | * We have received a `struct ClientStartMessage` from a client. Find |
@@ -122,7 +117,7 @@ static void | |||
122 | cleanup_task (void *cls, | 117 | cleanup_task (void *cls, |
123 | const struct GNUNET_SCHEDULER_TaskContext *tc) | 118 | const struct GNUNET_SCHEDULER_TaskContext *tc) |
124 | { | 119 | { |
125 | GAS_addresses_done (GSA_addresses); | 120 | GAS_addresses_done (); |
126 | GAS_scheduling_done (); | 121 | GAS_scheduling_done (); |
127 | GAS_performance_done (); | 122 | GAS_performance_done (); |
128 | GAS_reservations_done (); | 123 | GAS_reservations_done (); |
@@ -187,9 +182,20 @@ run (void *cls, | |||
187 | GSA_server = server; | 182 | GSA_server = server; |
188 | GSA_stats = GNUNET_STATISTICS_create ("ats", cfg); | 183 | GSA_stats = GNUNET_STATISTICS_create ("ats", cfg); |
189 | GAS_reservations_init (); | 184 | GAS_reservations_init (); |
190 | GSA_addresses = GAS_addresses_init (cfg, GSA_stats); | 185 | if (GNUNET_OK != |
191 | GAS_performance_init (server, GSA_addresses); | 186 | GAS_addresses_init (cfg, GSA_stats)) |
192 | GAS_scheduling_init (server, GSA_addresses); | 187 | { |
188 | GNUNET_break (0); | ||
189 | GAS_reservations_done (); | ||
190 | if (NULL != GSA_stats) | ||
191 | { | ||
192 | GNUNET_STATISTICS_destroy (GSA_stats, GNUNET_NO); | ||
193 | GSA_stats = NULL; | ||
194 | } | ||
195 | return; | ||
196 | } | ||
197 | GAS_performance_init (server); | ||
198 | GAS_scheduling_init (server); | ||
193 | 199 | ||
194 | GNUNET_SERVER_disconnect_notify (server, | 200 | GNUNET_SERVER_disconnect_notify (server, |
195 | &client_disconnect_handler, NULL); | 201 | &client_disconnect_handler, NULL); |