diff options
author | Christian Grothoff <christian@grothoff.org> | 2015-01-22 22:35:05 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2015-01-22 22:35:05 +0000 |
commit | 78b8e1c2a54c44992a16b65cdf67fea973e2cad0 (patch) | |
tree | 7ba43cb8271651a2c59125b2effd73bfd05c146a /src | |
parent | 9eb79c486b5e793d4a93e822c695b88b67981466 (diff) | |
download | gnunet-78b8e1c2a54c44992a16b65cdf67fea973e2cad0.tar.gz gnunet-78b8e1c2a54c44992a16b65cdf67fea973e2cad0.zip |
-indentation, do not pass stats arg as const just to then cast the const away
Diffstat (limited to 'src')
-rw-r--r-- | src/ats/gnunet-service-ats.c | 17 | ||||
-rw-r--r-- | src/ats/gnunet-service-ats_addresses.c | 67 | ||||
-rw-r--r-- | src/ats/gnunet-service-ats_addresses.h | 2 | ||||
-rw-r--r-- | src/ats/gnunet-service-ats_performance.c | 3 | ||||
-rw-r--r-- | src/ats/gnunet-service-ats_scheduling.c | 3 |
5 files changed, 58 insertions, 34 deletions
diff --git a/src/ats/gnunet-service-ats.c b/src/ats/gnunet-service-ats.c index 321166d5b..44bb1cebc 100644 --- a/src/ats/gnunet-service-ats.c +++ b/src/ats/gnunet-service-ats.c | |||
@@ -50,15 +50,16 @@ static struct GAS_Addresses_Handle *GSA_addresses; | |||
50 | 50 | ||
51 | 51 | ||
52 | /** | 52 | /** |
53 | * We have received a `struct ClientStartMessage` from a client. Find out which | 53 | * We have received a `struct ClientStartMessage` from a client. Find |
54 | * type of client it is and notify the respective subsystem. | 54 | * out which type of client it is and notify the respective subsystem. |
55 | * | 55 | * |
56 | * @param cls closure, unused | 56 | * @param cls closure, unused |
57 | * @param client handle to the client | 57 | * @param client handle to the client |
58 | * @param message the start message | 58 | * @param message the start message |
59 | */ | 59 | */ |
60 | static void | 60 | static void |
61 | handle_ats_start (void *cls, struct GNUNET_SERVER_Client *client, | 61 | handle_ats_start (void *cls, |
62 | struct GNUNET_SERVER_Client *client, | ||
62 | const struct GNUNET_MessageHeader *message) | 63 | const struct GNUNET_MessageHeader *message) |
63 | { | 64 | { |
64 | const struct ClientStartMessage *msg = | 65 | const struct ClientStartMessage *msg = |
@@ -150,7 +151,8 @@ run (void *cls, | |||
150 | { | 151 | { |
151 | static const struct GNUNET_SERVER_MessageHandler handlers[] = { | 152 | static const struct GNUNET_SERVER_MessageHandler handlers[] = { |
152 | {&handle_ats_start, NULL, | 153 | {&handle_ats_start, NULL, |
153 | GNUNET_MESSAGE_TYPE_ATS_START, sizeof (struct ClientStartMessage)}, | 154 | GNUNET_MESSAGE_TYPE_ATS_START, |
155 | sizeof (struct ClientStartMessage)}, | ||
154 | {&GAS_handle_request_address, NULL, | 156 | {&GAS_handle_request_address, NULL, |
155 | GNUNET_MESSAGE_TYPE_ATS_REQUEST_ADDRESS, | 157 | GNUNET_MESSAGE_TYPE_ATS_REQUEST_ADDRESS, |
156 | sizeof (struct RequestAddressMessage)}, | 158 | sizeof (struct RequestAddressMessage)}, |
@@ -189,10 +191,11 @@ run (void *cls, | |||
189 | GAS_performance_init (server, GSA_addresses); | 191 | GAS_performance_init (server, GSA_addresses); |
190 | GAS_scheduling_init (server, GSA_addresses); | 192 | GAS_scheduling_init (server, GSA_addresses); |
191 | 193 | ||
192 | GNUNET_SERVER_disconnect_notify (server, &client_disconnect_handler, NULL); | 194 | GNUNET_SERVER_disconnect_notify (server, |
195 | &client_disconnect_handler, NULL); | ||
193 | GNUNET_SERVER_add_handlers (server, handlers); | 196 | GNUNET_SERVER_add_handlers (server, handlers); |
194 | GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_FOREVER_REL, &cleanup_task, | 197 | GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_FOREVER_REL, |
195 | NULL); | 198 | &cleanup_task, NULL); |
196 | } | 199 | } |
197 | 200 | ||
198 | 201 | ||
diff --git a/src/ats/gnunet-service-ats_addresses.c b/src/ats/gnunet-service-ats_addresses.c index 53c8ca25c..73c19173b 100644 --- a/src/ats/gnunet-service-ats_addresses.c +++ b/src/ats/gnunet-service-ats_addresses.c | |||
@@ -270,8 +270,10 @@ struct GAS_Addresses_Preference_Clients | |||
270 | void *client; | 270 | void *client; |
271 | }; | 271 | }; |
272 | 272 | ||
273 | |||
273 | /** | 274 | /** |
274 | * Handle for ATS address component | 275 | * Handle for ATS address component. |
276 | * FIXME: these should probably all be 'static's instead. | ||
275 | */ | 277 | */ |
276 | struct GAS_Addresses_Handle | 278 | struct GAS_Addresses_Handle |
277 | { | 279 | { |
@@ -635,7 +637,7 @@ find_equivalent_address (struct GAS_Addresses_Handle *handle, | |||
635 | peer, | 637 | peer, |
636 | &compare_address_it, &cac); | 638 | &compare_address_it, &cac); |
637 | 639 | ||
638 | if (cac.exact_address == NULL) | 640 | if (NULL == cac.exact_address) |
639 | return cac.base_address; | 641 | return cac.base_address; |
640 | return cac.exact_address; | 642 | return cac.exact_address; |
641 | } | 643 | } |
@@ -819,7 +821,7 @@ GAS_addresses_add (struct GAS_Addresses_Handle *handle, | |||
819 | 821 | ||
820 | /* Get existing address or address with session == 0 */ | 822 | /* Get existing address or address with session == 0 */ |
821 | existing_address = find_equivalent_address (handle, peer, new_address); | 823 | existing_address = find_equivalent_address (handle, peer, new_address); |
822 | if (existing_address == NULL) | 824 | if (NULL == existing_address) |
823 | { | 825 | { |
824 | /* Add a new address */ | 826 | /* Add a new address */ |
825 | new_address->t_added = GNUNET_TIME_absolute_get(); | 827 | new_address->t_added = GNUNET_TIME_absolute_get(); |
@@ -862,6 +864,7 @@ GAS_addresses_add (struct GAS_Addresses_Handle *handle, | |||
862 | return; | 864 | return; |
863 | } | 865 | } |
864 | 866 | ||
867 | /* FIXME: this case should probably not be allowed... */ | ||
865 | /* We have an existing address we can use, clean up new */ | 868 | /* We have an existing address we can use, clean up new */ |
866 | GNUNET_free(new_address->plugin); | 869 | GNUNET_free(new_address->plugin); |
867 | GNUNET_free_non_null(new_address->atsi); | 870 | GNUNET_free_non_null(new_address->atsi); |
@@ -1172,8 +1175,10 @@ GAS_addresses_request_address_cancel (struct GAS_Addresses_Handle *handle, | |||
1172 | { | 1175 | { |
1173 | struct GAS_Addresses_Suggestion_Requests *cur = handle->pending_requests_head; | 1176 | struct GAS_Addresses_Suggestion_Requests *cur = handle->pending_requests_head; |
1174 | 1177 | ||
1175 | GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, "Received request: `%s' for peer %s\n", | 1178 | GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, |
1176 | "request_address_cancel", GNUNET_i2s (peer)); | 1179 | "Received request: `%s' for peer %s\n", |
1180 | "request_address_cancel", | ||
1181 | GNUNET_i2s (peer)); | ||
1177 | 1182 | ||
1178 | while (NULL != cur) | 1183 | while (NULL != cur) |
1179 | { | 1184 | { |
@@ -1191,9 +1196,12 @@ GAS_addresses_request_address_cancel (struct GAS_Addresses_Handle *handle, | |||
1191 | } | 1196 | } |
1192 | handle->env.sf.s_get_stop (handle->solver, peer); | 1197 | handle->env.sf.s_get_stop (handle->solver, peer); |
1193 | GAS_addresses_handle_backoff_reset (handle, peer); | 1198 | GAS_addresses_handle_backoff_reset (handle, peer); |
1194 | GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, "Removed request pending for peer `%s\n", | 1199 | GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, |
1195 | GNUNET_i2s (peer)); | 1200 | "Removed request pending for peer `%s\n", |
1196 | GNUNET_CONTAINER_DLL_remove(handle->pending_requests_head, handle->pending_requests_tail, cur); | 1201 | GNUNET_i2s (peer)); |
1202 | GNUNET_CONTAINER_DLL_remove (handle->pending_requests_head, | ||
1203 | handle->pending_requests_tail, | ||
1204 | cur); | ||
1197 | GNUNET_free(cur); | 1205 | GNUNET_free(cur); |
1198 | } | 1206 | } |
1199 | 1207 | ||
@@ -1211,8 +1219,10 @@ GAS_addresses_request_address (struct GAS_Addresses_Handle *handle, | |||
1211 | struct GAS_Addresses_Suggestion_Requests *cur = handle->pending_requests_head; | 1219 | struct GAS_Addresses_Suggestion_Requests *cur = handle->pending_requests_head; |
1212 | struct ATS_Address *aa; | 1220 | struct ATS_Address *aa; |
1213 | 1221 | ||
1214 | GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, "Received `%s' for peer `%s'\n", | 1222 | GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, |
1215 | "REQUEST ADDRESS", GNUNET_i2s (peer)); | 1223 | "Received `%s' for peer `%s'\n", |
1224 | "REQUEST ADDRESS", | ||
1225 | GNUNET_i2s (peer)); | ||
1216 | 1226 | ||
1217 | if (GNUNET_NO == handle->running) | 1227 | if (GNUNET_NO == handle->running) |
1218 | return; | 1228 | return; |
@@ -1316,7 +1326,6 @@ GAS_addresses_handle_backoff_reset (struct GAS_Addresses_Handle *handle, | |||
1316 | * @param stat operation status | 1326 | * @param stat operation status |
1317 | * @param add additional information | 1327 | * @param add additional information |
1318 | */ | 1328 | */ |
1319 | |||
1320 | static void | 1329 | static void |
1321 | solver_info_cb (void *cls, | 1330 | solver_info_cb (void *cls, |
1322 | enum GAS_Solver_Operation op, | 1331 | enum GAS_Solver_Operation op, |
@@ -1436,11 +1445,11 @@ normalized_preference_changed_cb (void *cls, | |||
1436 | * @param prop_rel the new relative preference value | 1445 | * @param prop_rel the new relative preference value |
1437 | */ | 1446 | */ |
1438 | static void | 1447 | static void |
1439 | normalized_property_changed_cb (void *cls, struct ATS_Address *address, | 1448 | normalized_property_changed_cb (void *cls, |
1440 | uint32_t type, double prop_rel) | 1449 | struct ATS_Address *address, |
1450 | uint32_t type, double prop_rel) | ||
1441 | { | 1451 | { |
1442 | struct GAS_Addresses_Handle *ah = (struct GAS_Addresses_Handle *) cls; | 1452 | struct GAS_Addresses_Handle *ah = cls; |
1443 | GNUNET_assert(NULL != ah); | ||
1444 | 1453 | ||
1445 | GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, | 1454 | GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, |
1446 | "Normalized property %s for peer `%s' changed to %.3f \n", | 1455 | "Normalized property %s for peer `%s' changed to %.3f \n", |
@@ -1450,6 +1459,7 @@ normalized_property_changed_cb (void *cls, struct ATS_Address *address, | |||
1450 | ah->env.sf.s_address_update_property (ah->solver, address, type, 0, prop_rel); | 1459 | ah->env.sf.s_address_update_property (ah->solver, address, type, 0, prop_rel); |
1451 | } | 1460 | } |
1452 | 1461 | ||
1462 | |||
1453 | static struct GAS_Addresses_Preference_Clients * | 1463 | static struct GAS_Addresses_Preference_Clients * |
1454 | find_preference_client (struct GAS_Addresses_Handle *handle, void *client) | 1464 | find_preference_client (struct GAS_Addresses_Handle *handle, void *client) |
1455 | { | 1465 | { |
@@ -1474,7 +1484,8 @@ void | |||
1474 | GAS_addresses_preference_client_disconnect (struct GAS_Addresses_Handle *handle, | 1484 | GAS_addresses_preference_client_disconnect (struct GAS_Addresses_Handle *handle, |
1475 | void *client) | 1485 | void *client) |
1476 | { | 1486 | { |
1477 | struct GAS_Addresses_Preference_Clients * pc; | 1487 | struct GAS_Addresses_Preference_Clients *pc; |
1488 | |||
1478 | if (NULL != (pc = find_preference_client (handle, client))) | 1489 | if (NULL != (pc = find_preference_client (handle, client))) |
1479 | { | 1490 | { |
1480 | GNUNET_CONTAINER_DLL_remove (handle->preference_clients_head, | 1491 | GNUNET_CONTAINER_DLL_remove (handle->preference_clients_head, |
@@ -1482,7 +1493,10 @@ GAS_addresses_preference_client_disconnect (struct GAS_Addresses_Handle *handle, | |||
1482 | GNUNET_free (pc); | 1493 | GNUNET_free (pc); |
1483 | GNUNET_assert (handle->pref_clients > 0); | 1494 | GNUNET_assert (handle->pref_clients > 0); |
1484 | handle->pref_clients --; | 1495 | handle->pref_clients --; |
1485 | GNUNET_STATISTICS_set (handle->stat, "# active performance clients", handle->pref_clients, GNUNET_NO); | 1496 | GNUNET_STATISTICS_set (handle->stat, |
1497 | "# active performance clients", | ||
1498 | handle->pref_clients, | ||
1499 | GNUNET_NO); | ||
1486 | } | 1500 | } |
1487 | GAS_normalization_preference_client_disconnect (client); | 1501 | GAS_normalization_preference_client_disconnect (client); |
1488 | } | 1502 | } |
@@ -1502,7 +1516,8 @@ GAS_addresses_preference_change (struct GAS_Addresses_Handle *handle, | |||
1502 | void *client, const struct GNUNET_PeerIdentity *peer, | 1516 | void *client, const struct GNUNET_PeerIdentity *peer, |
1503 | enum GNUNET_ATS_PreferenceKind kind, float score_abs) | 1517 | enum GNUNET_ATS_PreferenceKind kind, float score_abs) |
1504 | { | 1518 | { |
1505 | struct GAS_Addresses_Preference_Clients * pc; | 1519 | struct GAS_Addresses_Preference_Clients *pc; |
1520 | |||
1506 | GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, | 1521 | GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, |
1507 | "Received `%s' for peer `%s' for client %p\n", "CHANGE PREFERENCE", | 1522 | "Received `%s' for peer `%s' for client %p\n", "CHANGE PREFERENCE", |
1508 | GNUNET_i2s (peer), client); | 1523 | GNUNET_i2s (peer), client); |
@@ -1559,8 +1574,10 @@ GAS_addresses_preference_feedback (struct GAS_Addresses_Handle *handle, | |||
1559 | float score_abs) | 1574 | float score_abs) |
1560 | { | 1575 | { |
1561 | GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, | 1576 | GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, |
1562 | "Received `%s' for peer `%s' for client %p\n", "PREFERENCE FEEDBACK", | 1577 | "Received `%s' for peer `%s' for client %p\n", |
1563 | GNUNET_i2s (peer), application); | 1578 | "PREFERENCE FEEDBACK", |
1579 | GNUNET_i2s (peer), | ||
1580 | application); | ||
1564 | 1581 | ||
1565 | if (GNUNET_NO == handle->running) | 1582 | if (GNUNET_NO == handle->running) |
1566 | return; | 1583 | return; |
@@ -1811,7 +1828,7 @@ bandwidth_changed_cb (void *cls, struct ATS_Address *address) | |||
1811 | */ | 1828 | */ |
1812 | struct GAS_Addresses_Handle * | 1829 | struct GAS_Addresses_Handle * |
1813 | GAS_addresses_init (const struct GNUNET_CONFIGURATION_Handle *cfg, | 1830 | GAS_addresses_init (const struct GNUNET_CONFIGURATION_Handle *cfg, |
1814 | const struct GNUNET_STATISTICS_Handle *stats) | 1831 | struct GNUNET_STATISTICS_Handle *stats) |
1815 | { | 1832 | { |
1816 | struct GAS_Addresses_Handle *ah; | 1833 | struct GAS_Addresses_Handle *ah; |
1817 | unsigned long long quotas_in[GNUNET_ATS_NetworkTypeCount]; | 1834 | unsigned long long quotas_in[GNUNET_ATS_NetworkTypeCount]; |
@@ -1823,7 +1840,7 @@ GAS_addresses_init (const struct GNUNET_CONFIGURATION_Handle *cfg, | |||
1823 | ah = GNUNET_new (struct GAS_Addresses_Handle); | 1840 | ah = GNUNET_new (struct GAS_Addresses_Handle); |
1824 | ah->running = GNUNET_NO; | 1841 | ah->running = GNUNET_NO; |
1825 | 1842 | ||
1826 | ah->stat = (struct GNUNET_STATISTICS_Handle *) stats; | 1843 | ah->stat = stats; |
1827 | /* Initialize the addresses database */ | 1844 | /* Initialize the addresses database */ |
1828 | ah->addresses = GNUNET_CONTAINER_multipeermap_create (128, GNUNET_NO); | 1845 | ah->addresses = GNUNET_CONTAINER_multipeermap_create (128, GNUNET_NO); |
1829 | ah->pref_clients = 0; | 1846 | ah->pref_clients = 0; |
@@ -1943,8 +1960,10 @@ GAS_addresses_init (const struct GNUNET_CONFIGURATION_Handle *cfg, | |||
1943 | /* up and running */ | 1960 | /* up and running */ |
1944 | ah->running = GNUNET_YES; | 1961 | ah->running = GNUNET_YES; |
1945 | 1962 | ||
1946 | GNUNET_STATISTICS_set (ah->stat, "# addresses", | 1963 | GNUNET_STATISTICS_set (ah->stat, |
1947 | GNUNET_CONTAINER_multipeermap_size (ah->addresses), GNUNET_NO); | 1964 | "# addresses", |
1965 | GNUNET_CONTAINER_multipeermap_size (ah->addresses), | ||
1966 | GNUNET_NO); | ||
1948 | 1967 | ||
1949 | return ah; | 1968 | return ah; |
1950 | } | 1969 | } |
diff --git a/src/ats/gnunet-service-ats_addresses.h b/src/ats/gnunet-service-ats_addresses.h index d52f97f0f..ee599721d 100644 --- a/src/ats/gnunet-service-ats_addresses.h +++ b/src/ats/gnunet-service-ats_addresses.h | |||
@@ -424,7 +424,7 @@ struct GAS_Addresses_Handle; | |||
424 | */ | 424 | */ |
425 | struct GAS_Addresses_Handle * | 425 | struct GAS_Addresses_Handle * |
426 | GAS_addresses_init (const struct GNUNET_CONFIGURATION_Handle *cfg, | 426 | GAS_addresses_init (const struct GNUNET_CONFIGURATION_Handle *cfg, |
427 | const struct GNUNET_STATISTICS_Handle *stats); | 427 | struct GNUNET_STATISTICS_Handle *stats); |
428 | 428 | ||
429 | 429 | ||
430 | /** | 430 | /** |
diff --git a/src/ats/gnunet-service-ats_performance.c b/src/ats/gnunet-service-ats_performance.c index ad204fff3..2e205b982 100644 --- a/src/ats/gnunet-service-ats_performance.c +++ b/src/ats/gnunet-service-ats_performance.c | |||
@@ -619,7 +619,8 @@ GAS_handle_preference_change (void *cls, | |||
619 | uint32_t nump; | 619 | uint32_t nump; |
620 | uint32_t i; | 620 | uint32_t i; |
621 | 621 | ||
622 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Received `%s' message\n", | 622 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
623 | "Received `%s' message\n", | ||
623 | "PREFERENCE_CHANGE"); | 624 | "PREFERENCE_CHANGE"); |
624 | msize = ntohs (message->size); | 625 | msize = ntohs (message->size); |
625 | if (msize < sizeof (struct ChangePreferenceMessage)) | 626 | if (msize < sizeof (struct ChangePreferenceMessage)) |
diff --git a/src/ats/gnunet-service-ats_scheduling.c b/src/ats/gnunet-service-ats_scheduling.c index 65645d1f0..90893c08a 100644 --- a/src/ats/gnunet-service-ats_scheduling.c +++ b/src/ats/gnunet-service-ats_scheduling.c | |||
@@ -162,7 +162,8 @@ GAS_handle_request_address_cancel (void *cls, | |||
162 | const struct RequestAddressMessage *msg = | 162 | const struct RequestAddressMessage *msg = |
163 | (const struct RequestAddressMessage *) message; | 163 | (const struct RequestAddressMessage *) message; |
164 | 164 | ||
165 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Received `%s' message\n", | 165 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
166 | "Received `%s' message\n", | ||
166 | "REQUEST_ADDRESS_CANCEL"); | 167 | "REQUEST_ADDRESS_CANCEL"); |
167 | GNUNET_break (0 == ntohl (msg->reserved)); | 168 | GNUNET_break (0 == ntohl (msg->reserved)); |
168 | 169 | ||