diff options
author | Christian Grothoff <christian@grothoff.org> | 2013-12-09 14:39:30 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2013-12-09 14:39:30 +0000 |
commit | 8391d0a43629578c11f3044fdc3d9994a99a4682 (patch) | |
tree | 272b81716572a9e08d24534e25b7a1e908c783c8 /src | |
parent | 8efe79dfadceb61f752a08e2fc8c09f9fbe2ad4e (diff) | |
download | gnunet-8391d0a43629578c11f3044fdc3d9994a99a4682.tar.gz gnunet-8391d0a43629578c11f3044fdc3d9994a99a4682.zip |
-doxygen, indentation fixes
Diffstat (limited to 'src')
-rw-r--r-- | src/transport/gnunet-service-transport_neighbours.c | 65 |
1 files changed, 45 insertions, 20 deletions
diff --git a/src/transport/gnunet-service-transport_neighbours.c b/src/transport/gnunet-service-transport_neighbours.c index 6bb4b0672..c7d43ca56 100644 --- a/src/transport/gnunet-service-transport_neighbours.c +++ b/src/transport/gnunet-service-transport_neighbours.c | |||
@@ -1147,7 +1147,9 @@ disconnect_neighbour (struct NeighbourMapEntry *n) | |||
1147 | GNUNET_assert (0); | 1147 | GNUNET_assert (0); |
1148 | break; | 1148 | break; |
1149 | default: | 1149 | default: |
1150 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Unhandled state `%s' \n",print_state (n->state)); | 1150 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, |
1151 | "Unhandled state `%s'\n", | ||
1152 | print_state (n->state)); | ||
1151 | GNUNET_break (0); | 1153 | GNUNET_break (0); |
1152 | break; | 1154 | break; |
1153 | } | 1155 | } |
@@ -1654,7 +1656,7 @@ setup_neighbour (const struct GNUNET_PeerIdentity *peer) | |||
1654 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 1656 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
1655 | "Creating new neighbour entry for `%s'\n", | 1657 | "Creating new neighbour entry for `%s'\n", |
1656 | GNUNET_i2s (peer)); | 1658 | GNUNET_i2s (peer)); |
1657 | n = GNUNET_malloc (sizeof (struct NeighbourMapEntry)); | 1659 | n = GNUNET_new (struct NeighbourMapEntry); |
1658 | n->id = *peer; | 1660 | n->id = *peer; |
1659 | n->state = S_NOT_CONNECTED; | 1661 | n->state = S_NOT_CONNECTED; |
1660 | n->latency = GNUNET_TIME_UNIT_FOREVER_REL; | 1662 | n->latency = GNUNET_TIME_UNIT_FOREVER_REL; |
@@ -1768,7 +1770,9 @@ GST_neighbours_try_connect (const struct GNUNET_PeerIdentity *target) | |||
1768 | /* should not be possible */ | 1770 | /* should not be possible */ |
1769 | GNUNET_assert (0); | 1771 | GNUNET_assert (0); |
1770 | default: | 1772 | default: |
1771 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Unhandled state `%s' \n",print_state (n->state)); | 1773 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, |
1774 | "Unhandled state `%s'\n", | ||
1775 | print_state (n->state)); | ||
1772 | GNUNET_break (0); | 1776 | GNUNET_break (0); |
1773 | free_neighbour (n, GNUNET_NO); | 1777 | free_neighbour (n, GNUNET_NO); |
1774 | break; | 1778 | break; |
@@ -1989,7 +1993,9 @@ handle_test_blacklist_cont (void *cls, | |||
1989 | GNUNET_assert (0); | 1993 | GNUNET_assert (0); |
1990 | break; | 1994 | break; |
1991 | default: | 1995 | default: |
1992 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Unhandled state `%s' \n",print_state (n->state)); | 1996 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, |
1997 | "Unhandled state `%s'\n", | ||
1998 | print_state (n->state)); | ||
1993 | GNUNET_break (0); | 1999 | GNUNET_break (0); |
1994 | free_neighbour (n, GNUNET_NO); | 2000 | free_neighbour (n, GNUNET_NO); |
1995 | break; | 2001 | break; |
@@ -2142,7 +2148,9 @@ GST_neighbours_handle_connect (const struct GNUNET_MessageHeader *message, | |||
2142 | GNUNET_assert (0); | 2148 | GNUNET_assert (0); |
2143 | break; | 2149 | break; |
2144 | default: | 2150 | default: |
2145 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Unhandled state `%s' \n",print_state (n->state)); | 2151 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, |
2152 | "Unhandled state `%s'\n", | ||
2153 | print_state (n->state)); | ||
2146 | GNUNET_break (0); | 2154 | GNUNET_break (0); |
2147 | free_neighbour (n, GNUNET_NO); | 2155 | free_neighbour (n, GNUNET_NO); |
2148 | break; | 2156 | break; |
@@ -2370,16 +2378,19 @@ GST_neighbours_switch_to_address (const struct GNUNET_PeerIdentity *peer, | |||
2370 | GNUNET_assert (0); | 2378 | GNUNET_assert (0); |
2371 | break; | 2379 | break; |
2372 | default: | 2380 | default: |
2373 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Unhandled state `%s' \n",print_state (n->state)); | 2381 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, |
2382 | "Unhandled state `%s'\n", | ||
2383 | print_state (n->state)); | ||
2374 | GNUNET_break (0); | 2384 | GNUNET_break (0); |
2375 | break; | 2385 | break; |
2376 | } | 2386 | } |
2377 | } | 2387 | } |
2378 | 2388 | ||
2389 | |||
2379 | static int | 2390 | static int |
2380 | send_utilization_data (void *cls, | 2391 | send_utilization_data (void *cls, |
2381 | const struct GNUNET_PeerIdentity *key, | 2392 | const struct GNUNET_PeerIdentity *key, |
2382 | void *value) | 2393 | void *value) |
2383 | { | 2394 | { |
2384 | struct NeighbourMapEntry *n = value; | 2395 | struct NeighbourMapEntry *n = value; |
2385 | struct GNUNET_ATS_Information atsi[4]; | 2396 | struct GNUNET_ATS_Information atsi[4]; |
@@ -2389,7 +2400,8 @@ send_utilization_data (void *cls, | |||
2389 | uint32_t bps_out; | 2400 | uint32_t bps_out; |
2390 | struct GNUNET_TIME_Relative delta; | 2401 | struct GNUNET_TIME_Relative delta; |
2391 | 2402 | ||
2392 | delta = GNUNET_TIME_absolute_get_difference(n->last_util_transmission, GNUNET_TIME_absolute_get()); | 2403 | delta = GNUNET_TIME_absolute_get_difference (n->last_util_transmission, |
2404 | GNUNET_TIME_absolute_get ()); | ||
2393 | 2405 | ||
2394 | bps_pl_in = 0; | 2406 | bps_pl_in = 0; |
2395 | 2407 | ||
@@ -2398,9 +2410,11 @@ send_utilization_data (void *cls, | |||
2398 | bps_pl_out = 0; | 2410 | bps_pl_out = 0; |
2399 | if ((0 != n->util_payload_bytes_sent) && (0 != delta.rel_value_us)) | 2411 | if ((0 != n->util_payload_bytes_sent) && (0 != delta.rel_value_us)) |
2400 | bps_pl_out = (1000LL * 1000LL * n->util_payload_bytes_sent) / delta.rel_value_us; | 2412 | bps_pl_out = (1000LL * 1000LL * n->util_payload_bytes_sent) / delta.rel_value_us; |
2401 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "`%s' payload: received %u Bytes/s, sent %u Bytes/s \n", | 2413 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
2402 | GNUNET_i2s (key), bps_pl_in, bps_pl_out); | 2414 | "`%s' payload: received %u Bytes/s, sent %u Bytes/s\n", |
2403 | 2415 | GNUNET_i2s (key), | |
2416 | bps_pl_in, | ||
2417 | bps_pl_out); | ||
2404 | bps_in = 0; | 2418 | bps_in = 0; |
2405 | if ((0 != n->util_total_bytes_recv) && (0 != delta.rel_value_us)) | 2419 | if ((0 != n->util_total_bytes_recv) && (0 != delta.rel_value_us)) |
2406 | bps_in = (1000LL * 1000LL * n->util_total_bytes_recv) / (delta.rel_value_us); | 2420 | bps_in = (1000LL * 1000LL * n->util_total_bytes_recv) / (delta.rel_value_us); |
@@ -2409,9 +2423,11 @@ send_utilization_data (void *cls, | |||
2409 | bps_out = (1000LL * 1000LL * n->util_total_bytes_sent) / delta.rel_value_us; | 2423 | bps_out = (1000LL * 1000LL * n->util_total_bytes_sent) / delta.rel_value_us; |
2410 | 2424 | ||
2411 | 2425 | ||
2412 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "`%s' total: received %u Bytes/s, sent %u Bytes/s \n", | 2426 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
2413 | GNUNET_i2s (key), bps_in, bps_out); | 2427 | "`%s' total: received %u Bytes/s, sent %u Bytes/s\n", |
2414 | 2428 | GNUNET_i2s (key), | |
2429 | bps_in, | ||
2430 | bps_out); | ||
2415 | atsi[0].type = htonl (GNUNET_ATS_UTILIZATION_OUT); | 2431 | atsi[0].type = htonl (GNUNET_ATS_UTILIZATION_OUT); |
2416 | atsi[0].value = htonl (bps_out); | 2432 | atsi[0].value = htonl (bps_out); |
2417 | atsi[1].type = htonl (GNUNET_ATS_UTILIZATION_IN); | 2433 | atsi[1].type = htonl (GNUNET_ATS_UTILIZATION_IN); |
@@ -2432,6 +2448,7 @@ send_utilization_data (void *cls, | |||
2432 | return GNUNET_OK; | 2448 | return GNUNET_OK; |
2433 | } | 2449 | } |
2434 | 2450 | ||
2451 | |||
2435 | /** | 2452 | /** |
2436 | * Task transmitting utilization in a regular interval | 2453 | * Task transmitting utilization in a regular interval |
2437 | * | 2454 | * |
@@ -2695,7 +2712,9 @@ master_task (void *cls, | |||
2695 | GNUNET_assert (0); | 2712 | GNUNET_assert (0); |
2696 | break; | 2713 | break; |
2697 | default: | 2714 | default: |
2698 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Unhandled state `%s' \n",print_state (n->state)); | 2715 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, |
2716 | "Unhandled state `%s'\n", | ||
2717 | print_state (n->state)); | ||
2699 | GNUNET_break (0); | 2718 | GNUNET_break (0); |
2700 | break; | 2719 | break; |
2701 | } | 2720 | } |
@@ -2868,7 +2887,9 @@ GST_neighbours_handle_connect_ack (const struct GNUNET_MessageHeader *message, | |||
2868 | GNUNET_assert (0); | 2887 | GNUNET_assert (0); |
2869 | break; | 2888 | break; |
2870 | default: | 2889 | default: |
2871 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Unhandled state `%s' \n",print_state (n->state)); | 2890 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, |
2891 | "Unhandled state `%s'\n", | ||
2892 | print_state (n->state)); | ||
2872 | GNUNET_break (0); | 2893 | GNUNET_break (0); |
2873 | break; | 2894 | break; |
2874 | } | 2895 | } |
@@ -2994,7 +3015,9 @@ GST_neighbours_session_terminated (const struct GNUNET_PeerIdentity *peer, | |||
2994 | return GNUNET_NO; | 3015 | return GNUNET_NO; |
2995 | break; | 3016 | break; |
2996 | default: | 3017 | default: |
2997 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Unhandled state `%s' \n",print_state (n->state)); | 3018 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, |
3019 | "Unhandled state `%s'\n", | ||
3020 | print_state (n->state)); | ||
2998 | GNUNET_break (0); | 3021 | GNUNET_break (0); |
2999 | break; | 3022 | break; |
3000 | } | 3023 | } |
@@ -3322,7 +3345,9 @@ GST_neighbour_get_latency (const struct GNUNET_PeerIdentity *peer) | |||
3322 | case S_DISCONNECT_FINISHED: | 3345 | case S_DISCONNECT_FINISHED: |
3323 | return GNUNET_TIME_UNIT_FOREVER_REL; | 3346 | return GNUNET_TIME_UNIT_FOREVER_REL; |
3324 | default: | 3347 | default: |
3325 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Unhandled state `%s' \n",print_state (n->state)); | 3348 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, |
3349 | "Unhandled state `%s'\n", | ||
3350 | print_state (n->state)); | ||
3326 | GNUNET_break (0); | 3351 | GNUNET_break (0); |
3327 | break; | 3352 | break; |
3328 | } | 3353 | } |
@@ -3381,7 +3406,7 @@ GST_neighbours_start (void *cls, | |||
3381 | * @param cls unused | 3406 | * @param cls unused |
3382 | * @param key hash of neighbour's public key (not used) | 3407 | * @param key hash of neighbour's public key (not used) |
3383 | * @param value the 'struct NeighbourMapEntry' of the neighbour | 3408 | * @param value the 'struct NeighbourMapEntry' of the neighbour |
3384 | * @return GNUNET_OK (continue to iterate) | 3409 | * @return #GNUNET_OK (continue to iterate) |
3385 | */ | 3410 | */ |
3386 | static int | 3411 | static int |
3387 | disconnect_all_neighbours (void *cls, | 3412 | disconnect_all_neighbours (void *cls, |