summaryrefslogtreecommitdiff
path: root/src/ats/gnunet-service-ats.c
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2011-11-04 14:00:32 +0000
committerChristian Grothoff <christian@grothoff.org>2011-11-04 14:00:32 +0000
commit83b19539f4d322b43683f5838b72e9ec2c8e6073 (patch)
treed0ab9329fcbefe360d9d14e2ace21a6b3396dfe9 /src/ats/gnunet-service-ats.c
parent28a2eb43281a1f08a67954f07beb9af3a9bc9a35 (diff)
downloadgnunet-83b19539f4d322b43683f5838b72e9ec2c8e6073.tar.gz
gnunet-83b19539f4d322b43683f5838b72e9ec2c8e6073.zip
curly wars / auto-indentation
Diffstat (limited to 'src/ats/gnunet-service-ats.c')
-rw-r--r--src/ats/gnunet-service-ats.c49
1 files changed, 24 insertions, 25 deletions
diff --git a/src/ats/gnunet-service-ats.c b/src/ats/gnunet-service-ats.c
index 563550ece..ec374aef8 100644
--- a/src/ats/gnunet-service-ats.c
+++ b/src/ats/gnunet-service-ats.c
@@ -48,14 +48,13 @@ struct GNUNET_STATISTICS_Handle *GSA_stats;
48 */ 48 */
49static void 49static void
50handle_ats_start (void *cls, struct GNUNET_SERVER_Client *client, 50handle_ats_start (void *cls, struct GNUNET_SERVER_Client *client,
51 const struct GNUNET_MessageHeader *message) 51 const struct GNUNET_MessageHeader *message)
52{ 52{
53 const struct ClientStartMessage * msg = (const struct ClientStartMessage *) message; 53 const struct ClientStartMessage *msg =
54 (const struct ClientStartMessage *) message;
54 enum StartFlag flag; 55 enum StartFlag flag;
55 56
56 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 57 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Received `%s' message\n", "ATS_START");
57 "Received `%s' message\n",
58 "ATS_START");
59 flag = ntohl (msg->start_flag); 58 flag = ntohl (msg->start_flag);
60 switch (flag) 59 switch (flag)
61 { 60 {
@@ -77,7 +76,7 @@ handle_ats_start (void *cls, struct GNUNET_SERVER_Client *client,
77 GNUNET_SERVER_receive_done (client, GNUNET_SYSERR); 76 GNUNET_SERVER_receive_done (client, GNUNET_SYSERR);
78 return; 77 return;
79 } 78 }
80 GNUNET_SERVER_receive_done (client, GNUNET_OK); 79 GNUNET_SERVER_receive_done (client, GNUNET_OK);
81} 80}
82 81
83 82
@@ -131,20 +130,22 @@ run (void *cls, struct GNUNET_SERVER_Handle *server,
131 const struct GNUNET_CONFIGURATION_Handle *cfg) 130 const struct GNUNET_CONFIGURATION_Handle *cfg)
132{ 131{
133 static const struct GNUNET_SERVER_MessageHandler handlers[] = { 132 static const struct GNUNET_SERVER_MessageHandler handlers[] = {
134 { &handle_ats_start, NULL, 133 {&handle_ats_start, NULL,
135 GNUNET_MESSAGE_TYPE_ATS_START, sizeof (struct ClientStartMessage)}, 134 GNUNET_MESSAGE_TYPE_ATS_START, sizeof (struct ClientStartMessage)},
136 { &GAS_handle_request_address, NULL, 135 {&GAS_handle_request_address, NULL,
137 GNUNET_MESSAGE_TYPE_ATS_REQUEST_ADDRESS, sizeof (struct RequestAddressMessage)}, 136 GNUNET_MESSAGE_TYPE_ATS_REQUEST_ADDRESS,
138 { &GAS_handle_address_update, NULL, 137 sizeof (struct RequestAddressMessage)},
139 GNUNET_MESSAGE_TYPE_ATS_ADDRESS_UPDATE, 0}, 138 {&GAS_handle_address_update, NULL,
140 { &GAS_handle_address_in_use, NULL, 139 GNUNET_MESSAGE_TYPE_ATS_ADDRESS_UPDATE, 0},
141 GNUNET_MESSAGE_TYPE_ATS_ADDRESS_IN_USE, 0}, 140 {&GAS_handle_address_in_use, NULL,
142 { &GAS_handle_address_destroyed, NULL, 141 GNUNET_MESSAGE_TYPE_ATS_ADDRESS_IN_USE, 0},
143 GNUNET_MESSAGE_TYPE_ATS_ADDRESS_DESTROYED, 0}, 142 {&GAS_handle_address_destroyed, NULL,
144 { &GAS_handle_reservation_request, NULL, 143 GNUNET_MESSAGE_TYPE_ATS_ADDRESS_DESTROYED, 0},
145 GNUNET_MESSAGE_TYPE_ATS_RESERVATION_REQUEST, sizeof (struct ReservationRequestMessage)}, 144 {&GAS_handle_reservation_request, NULL,
146 { &GAS_handle_preference_change, NULL, 145 GNUNET_MESSAGE_TYPE_ATS_RESERVATION_REQUEST,
147 GNUNET_MESSAGE_TYPE_ATS_PREFERENCE_CHANGE, 0}, 146 sizeof (struct ReservationRequestMessage)},
147 {&GAS_handle_preference_change, NULL,
148 GNUNET_MESSAGE_TYPE_ATS_PREFERENCE_CHANGE, 0},
148 {NULL, NULL, 0, 0} 149 {NULL, NULL, 0, 0}
149 }; 150 };
150 GSA_stats = GNUNET_STATISTICS_create ("ats", cfg); 151 GSA_stats = GNUNET_STATISTICS_create ("ats", cfg);
@@ -152,9 +153,7 @@ run (void *cls, struct GNUNET_SERVER_Handle *server,
152 GAS_performance_init (server); 153 GAS_performance_init (server);
153 GAS_scheduling_init (server); 154 GAS_scheduling_init (server);
154 GAS_addresses_init (cfg); 155 GAS_addresses_init (cfg);
155 GNUNET_SERVER_disconnect_notify (server, 156 GNUNET_SERVER_disconnect_notify (server, &client_disconnect_handler, NULL);
156 &client_disconnect_handler,
157 NULL);
158 GNUNET_SERVER_add_handlers (server, handlers); 157 GNUNET_SERVER_add_handlers (server, handlers);
159 GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_FOREVER_REL, &cleanup_task, 158 GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_FOREVER_REL, &cleanup_task,
160 NULL); 159 NULL);
@@ -172,8 +171,8 @@ int
172main (int argc, char *const *argv) 171main (int argc, char *const *argv)
173{ 172{
174 return (GNUNET_OK == 173 return (GNUNET_OK ==
175 GNUNET_SERVICE_run (argc, argv, "ats", 174 GNUNET_SERVICE_run (argc, argv, "ats", GNUNET_SERVICE_OPTION_NONE,
176 GNUNET_SERVICE_OPTION_NONE, &run, NULL)) ? 0 : 1; 175 &run, NULL)) ? 0 : 1;
177} 176}
178 177
179/* end of gnunet-service-ats.c */ 178/* end of gnunet-service-ats.c */