diff options
author | Christian Grothoff <christian@grothoff.org> | 2013-12-18 22:57:56 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2013-12-18 22:57:56 +0000 |
commit | 64326ced152aaa860072b77b6bcf7d04083d1e80 (patch) | |
tree | 85bee80bb41f5be7ebb0a628e33842ee7abab1ca | |
parent | 647ec74b097c5581664362b4d5a2f7759553370a (diff) | |
download | gnunet-64326ced152aaa860072b77b6bcf7d04083d1e80.tar.gz gnunet-64326ced152aaa860072b77b6bcf7d04083d1e80.zip |
-more logging
-rw-r--r-- | src/transport/gnunet-service-transport_clients.h | 10 | ||||
-rw-r--r-- | src/transport/gnunet-service-transport_neighbours.c | 56 |
2 files changed, 41 insertions, 25 deletions
diff --git a/src/transport/gnunet-service-transport_clients.h b/src/transport/gnunet-service-transport_clients.h index 25d075864..6a140c788 100644 --- a/src/transport/gnunet-service-transport_clients.h +++ b/src/transport/gnunet-service-transport_clients.h | |||
@@ -52,7 +52,7 @@ GST_clients_stop (void); | |||
52 | * Broadcast the given message to all of our clients. | 52 | * Broadcast the given message to all of our clients. |
53 | * | 53 | * |
54 | * @param msg message to broadcast | 54 | * @param msg message to broadcast |
55 | * @param may_drop GNUNET_YES if the message can be dropped / is payload | 55 | * @param may_drop #GNUNET_YES if the message can be dropped / is payload |
56 | */ | 56 | */ |
57 | void | 57 | void |
58 | GST_clients_broadcast (const struct GNUNET_MessageHeader *msg, int may_drop); | 58 | GST_clients_broadcast (const struct GNUNET_MessageHeader *msg, int may_drop); |
@@ -63,7 +63,7 @@ GST_clients_broadcast (const struct GNUNET_MessageHeader *msg, int may_drop); | |||
63 | * | 63 | * |
64 | * @param client target of the message | 64 | * @param client target of the message |
65 | * @param msg message to transmit | 65 | * @param msg message to transmit |
66 | * @param may_drop GNUNET_YES if the message can be dropped | 66 | * @param may_drop #GNUNET_YES if the message can be dropped |
67 | */ | 67 | */ |
68 | void | 68 | void |
69 | GST_clients_unicast (struct GNUNET_SERVER_Client *client, | 69 | GST_clients_unicast (struct GNUNET_SERVER_Client *client, |
@@ -77,10 +77,8 @@ GST_clients_unicast (struct GNUNET_SERVER_Client *client, | |||
77 | * @param address address, NULL on disconnect | 77 | * @param address address, NULL on disconnect |
78 | */ | 78 | */ |
79 | void | 79 | void |
80 | GST_clients_broadcast_address_notification (const struct GNUNET_PeerIdentity | 80 | GST_clients_broadcast_address_notification (const struct GNUNET_PeerIdentity *peer, |
81 | *peer, | 81 | const struct GNUNET_HELLO_Address *address); |
82 | const struct GNUNET_HELLO_Address | ||
83 | *address); | ||
84 | 82 | ||
85 | 83 | ||
86 | #endif | 84 | #endif |
diff --git a/src/transport/gnunet-service-transport_neighbours.c b/src/transport/gnunet-service-transport_neighbours.c index 3dd00015a..534af0aa0 100644 --- a/src/transport/gnunet-service-transport_neighbours.c +++ b/src/transport/gnunet-service-transport_neighbours.c | |||
@@ -674,10 +674,15 @@ lookup_neighbour (const struct GNUNET_PeerIdentity *pid) | |||
674 | } | 674 | } |
675 | 675 | ||
676 | 676 | ||
677 | /** | ||
678 | * Convert state to human-readable string. | ||
679 | * | ||
680 | * @param state the state value | ||
681 | * @return corresponding string | ||
682 | */ | ||
677 | static const char * | 683 | static const char * |
678 | print_state (int state) | 684 | print_state (enum State state) |
679 | { | 685 | { |
680 | |||
681 | switch (state) | 686 | switch (state) |
682 | { | 687 | { |
683 | case S_NOT_CONNECTED: | 688 | case S_NOT_CONNECTED: |
@@ -1110,6 +1115,10 @@ send_disconnect (struct NeighbourMapEntry *n) | |||
1110 | static void | 1115 | static void |
1111 | disconnect_neighbour (struct NeighbourMapEntry *n) | 1116 | disconnect_neighbour (struct NeighbourMapEntry *n) |
1112 | { | 1117 | { |
1118 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | ||
1119 | "Disconnecting from peer %s in state %s\n", | ||
1120 | GNUNET_i2s (&n->id), | ||
1121 | print_state (n->state)); | ||
1113 | /* depending on state, notify neighbour and/or upper layers of this peer | 1122 | /* depending on state, notify neighbour and/or upper layers of this peer |
1114 | about disconnect */ | 1123 | about disconnect */ |
1115 | switch (n->state) | 1124 | switch (n->state) |
@@ -1216,12 +1225,12 @@ transmit_send_continuation (void *cls, | |||
1216 | } | 1225 | } |
1217 | if (bytes_in_send_queue < mq->message_buf_size) | 1226 | if (bytes_in_send_queue < mq->message_buf_size) |
1218 | { | 1227 | { |
1219 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, | 1228 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, |
1220 | "Bytes_in_send_queue `%u', Message_size %u, result: %s, payload %u, on wire %u\n", | 1229 | "Bytes_in_send_queue `%u', Message_size %u, result: %s, payload %u, on wire %u\n", |
1221 | bytes_in_send_queue, mq->message_buf_size, | 1230 | bytes_in_send_queue, mq->message_buf_size, |
1222 | (GNUNET_OK == success) ? "OK" : "FAIL", | 1231 | (GNUNET_OK == success) ? "OK" : "FAIL", |
1223 | size_payload, physical); | 1232 | size_payload, physical); |
1224 | GNUNET_break (0); | 1233 | GNUNET_break (0); |
1225 | } | 1234 | } |
1226 | 1235 | ||
1227 | 1236 | ||
@@ -1300,7 +1309,9 @@ try_transmission_to_peer (struct NeighbourMapEntry *n) | |||
1300 | 1, GNUNET_NO); | 1309 | 1, GNUNET_NO); |
1301 | GNUNET_CONTAINER_DLL_remove (n->messages_head, n->messages_tail, mq); | 1310 | GNUNET_CONTAINER_DLL_remove (n->messages_head, n->messages_tail, mq); |
1302 | n->is_active = mq; | 1311 | n->is_active = mq; |
1303 | transmit_send_continuation (mq, &n->id, GNUNET_SYSERR, mq->message_buf_size, 0); /* timeout */ | 1312 | transmit_send_continuation (mq, &n->id, |
1313 | GNUNET_SYSERR, | ||
1314 | mq->message_buf_size, 0); /* timeout */ | ||
1304 | } | 1315 | } |
1305 | if (NULL == mq) | 1316 | if (NULL == mq) |
1306 | return; /* no more messages */ | 1317 | return; /* no more messages */ |
@@ -1517,9 +1528,9 @@ GST_neighbours_keepalive_response (const struct GNUNET_PeerIdentity *neighbour, | |||
1517 | * | 1528 | * |
1518 | * @param sender sender of the message | 1529 | * @param sender sender of the message |
1519 | * @param size size of the message | 1530 | * @param size size of the message |
1520 | * @param do_forward set to GNUNET_YES if the message should be forwarded to clients | 1531 | * @param do_forward set to #GNUNET_YES if the message should be forwarded to clients |
1521 | * GNUNET_NO if the neighbour is not connected or violates the quota, | 1532 | * #GNUNET_NO if the neighbour is not connected or violates the quota, |
1522 | * GNUNET_SYSERR if the connection is not fully up yet | 1533 | * #GNUNET_SYSERR if the connection is not fully up yet |
1523 | * @return how long to wait before reading more from this sender | 1534 | * @return how long to wait before reading more from this sender |
1524 | */ | 1535 | */ |
1525 | struct GNUNET_TIME_Relative | 1536 | struct GNUNET_TIME_Relative |
@@ -2321,9 +2332,10 @@ GST_neighbours_switch_to_address (const struct GNUNET_PeerIdentity *peer, | |||
2321 | } | 2332 | } |
2322 | 2333 | ||
2323 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 2334 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
2324 | "ATS tells us to switch to address '%s' session %p for " | 2335 | "ATS tells us to switch to address '%s/%s' session %p for " |
2325 | "peer `%s' in state %s/%d (quota in/out %u %u )\n", | 2336 | "peer `%s' in state %s/%d (quota in/out %u %u )\n", |
2326 | (address->address_length != 0) ? GST_plugins_a2s (address): "<inbound>", | 2337 | (address->address_length != 0) ? GST_plugins_a2s (address): "<inbound>", |
2338 | address->transport_name, | ||
2327 | session, | 2339 | session, |
2328 | GNUNET_i2s (peer), | 2340 | GNUNET_i2s (peer), |
2329 | print_state (n->state), | 2341 | print_state (n->state), |
@@ -2401,6 +2413,7 @@ GST_neighbours_switch_to_address (const struct GNUNET_PeerIdentity *peer, | |||
2401 | address and check blacklist again */ | 2413 | address and check blacklist again */ |
2402 | set_address (&n->primary_address, | 2414 | set_address (&n->primary_address, |
2403 | address, session, bandwidth_in, bandwidth_out, GNUNET_NO); | 2415 | address, session, bandwidth_in, bandwidth_out, GNUNET_NO); |
2416 | n->state = S_CONNECT_RECV_BLACKLIST; | ||
2404 | n->timeout = GNUNET_TIME_relative_to_absolute (BLACKLIST_RESPONSE_TIMEOUT); | 2417 | n->timeout = GNUNET_TIME_relative_to_absolute (BLACKLIST_RESPONSE_TIMEOUT); |
2405 | check_blacklist (&n->id, | 2418 | check_blacklist (&n->id, |
2406 | n->connect_ack_timestamp, | 2419 | n->connect_ack_timestamp, |
@@ -3277,8 +3290,9 @@ GST_neighbours_set_incoming_quota (const struct GNUNET_PeerIdentity *neighbour, | |||
3277 | GNUNET_BANDWIDTH_tracker_update_quota (&n->in_tracker, quota); | 3290 | GNUNET_BANDWIDTH_tracker_update_quota (&n->in_tracker, quota); |
3278 | if (0 != ntohl (quota.value__)) | 3291 | if (0 != ntohl (quota.value__)) |
3279 | return; | 3292 | return; |
3280 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Disconnecting peer `%4s' due to `%s'\n", | 3293 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
3281 | GNUNET_i2s (&n->id), "SET_QUOTA"); | 3294 | "Disconnecting peer `%4s' due to SET_QUOTA\n", |
3295 | GNUNET_i2s (&n->id)); | ||
3282 | if (GNUNET_YES == test_connected (n)) | 3296 | if (GNUNET_YES == test_connected (n)) |
3283 | GNUNET_STATISTICS_update (GST_stats, | 3297 | GNUNET_STATISTICS_update (GST_stats, |
3284 | gettext_noop ("# disconnects due to quota of 0"), | 3298 | gettext_noop ("# disconnects due to quota of 0"), |
@@ -3295,10 +3309,8 @@ GST_neighbours_set_incoming_quota (const struct GNUNET_PeerIdentity *neighbour, | |||
3295 | * @param msg the disconnect message | 3309 | * @param msg the disconnect message |
3296 | */ | 3310 | */ |
3297 | void | 3311 | void |
3298 | GST_neighbours_handle_disconnect_message (const struct GNUNET_PeerIdentity | 3312 | GST_neighbours_handle_disconnect_message (const struct GNUNET_PeerIdentity *peer, |
3299 | *peer, | 3313 | const struct GNUNET_MessageHeader *msg) |
3300 | const struct GNUNET_MessageHeader | ||
3301 | *msg) | ||
3302 | { | 3314 | { |
3303 | struct NeighbourMapEntry *n; | 3315 | struct NeighbourMapEntry *n; |
3304 | const struct SessionDisconnectMessage *sdm; | 3316 | const struct SessionDisconnectMessage *sdm; |
@@ -3364,6 +3376,9 @@ GST_neighbours_handle_disconnect_message (const struct GNUNET_PeerIdentity | |||
3364 | gettext_noop | 3376 | gettext_noop |
3365 | ("# other peer asked to disconnect from us"), 1, | 3377 | ("# other peer asked to disconnect from us"), 1, |
3366 | GNUNET_NO); | 3378 | GNUNET_NO); |
3379 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | ||
3380 | "Disconnecting by request from peer %s\n", | ||
3381 | GNUNET_i2s (peer)); | ||
3367 | disconnect_neighbour (n); | 3382 | disconnect_neighbour (n); |
3368 | } | 3383 | } |
3369 | 3384 | ||
@@ -3459,6 +3474,9 @@ GST_neighbours_force_disconnect (const struct GNUNET_PeerIdentity *target) | |||
3459 | gettext_noop | 3474 | gettext_noop |
3460 | ("# disconnected from peer upon explicit request"), 1, | 3475 | ("# disconnected from peer upon explicit request"), 1, |
3461 | GNUNET_NO); | 3476 | GNUNET_NO); |
3477 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | ||
3478 | "Forced disconnect from peer %s\n", | ||
3479 | GNUNET_i2s (target)); | ||
3462 | disconnect_neighbour (n); | 3480 | disconnect_neighbour (n); |
3463 | } | 3481 | } |
3464 | 3482 | ||