diff options
author | Christian Grothoff <christian@grothoff.org> | 2011-05-25 10:21:22 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2011-05-25 10:21:22 +0000 |
commit | 1e30974ec0ae6efd6516ec14d27d339339dad08c (patch) | |
tree | 96c68d41e92a91afc17c26e9ac1ef516c5cac156 /src/core/gnunet-service-core.c | |
parent | 1184451771a924952811002dad0b03b063ab3681 (diff) | |
download | gnunet-1e30974ec0ae6efd6516ec14d27d339339dad08c.tar.gz gnunet-1e30974ec0ae6efd6516ec14d27d339339dad08c.zip |
clean up logging, set rim ID always, even if neighbour was not found
Diffstat (limited to 'src/core/gnunet-service-core.c')
-rw-r--r-- | src/core/gnunet-service-core.c | 69 |
1 files changed, 40 insertions, 29 deletions
diff --git a/src/core/gnunet-service-core.c b/src/core/gnunet-service-core.c index fce515e0f..0b7886796 100644 --- a/src/core/gnunet-service-core.c +++ b/src/core/gnunet-service-core.c | |||
@@ -963,7 +963,7 @@ send_to_client (struct Client *client, | |||
963 | const struct GNUNET_MessageHeader *msg, | 963 | const struct GNUNET_MessageHeader *msg, |
964 | int can_drop) | 964 | int can_drop) |
965 | { | 965 | { |
966 | #if DEBUG_CORE_CLIENT | 966 | #if DEBUG_CORE_CLIENT |
967 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 967 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
968 | "Preparing to send %u bytes of message of type %u to client.\n", | 968 | "Preparing to send %u bytes of message of type %u to client.\n", |
969 | (unsigned int) ntohs (msg->size), | 969 | (unsigned int) ntohs (msg->size), |
@@ -996,7 +996,7 @@ send_to_all_clients (const struct GNUNET_MessageHeader *msg, | |||
996 | { | 996 | { |
997 | if (0 != (c->options & options)) | 997 | if (0 != (c->options & options)) |
998 | { | 998 | { |
999 | #if DEBUG_CORE_CLIENT | 999 | #if DEBUG_CORE_CLIENT > 1 |
1000 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 1000 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
1001 | "Sending message of type %u to client.\n", | 1001 | "Sending message of type %u to client.\n", |
1002 | (unsigned int) ntohs (msg->type)); | 1002 | (unsigned int) ntohs (msg->type)); |
@@ -1025,7 +1025,7 @@ handle_peer_status_change (struct Neighbour *n) | |||
1025 | if ( (! n->is_connected) || | 1025 | if ( (! n->is_connected) || |
1026 | (n->status != PEER_STATE_KEY_CONFIRMED) ) | 1026 | (n->status != PEER_STATE_KEY_CONFIRMED) ) |
1027 | return; | 1027 | return; |
1028 | #if DEBUG_CORE | 1028 | #if DEBUG_CORE > 1 |
1029 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 1029 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
1030 | "Peer `%4s' changed status\n", | 1030 | "Peer `%4s' changed status\n", |
1031 | GNUNET_i2s (&n->peer)); | 1031 | GNUNET_i2s (&n->peer)); |
@@ -1652,13 +1652,22 @@ handle_client_request_info (void *cls, | |||
1652 | #endif | 1652 | #endif |
1653 | cim.reserved_amount = htonl (got_reserv); | 1653 | cim.reserved_amount = htonl (got_reserv); |
1654 | cim.reserve_delay = GNUNET_TIME_relative_hton (rdelay); | 1654 | cim.reserve_delay = GNUNET_TIME_relative_hton (rdelay); |
1655 | cim.rim_id = rcm->rim_id; | ||
1656 | cim.bw_out = n->bw_out; | 1655 | cim.bw_out = n->bw_out; |
1657 | cim.preference = n->current_preference; | 1656 | cim.preference = n->current_preference; |
1658 | } | 1657 | } |
1658 | else | ||
1659 | { | ||
1660 | /* Technically, this COULD happen (due to asynchronous behavior), | ||
1661 | but it is very odd, so we should at least generate a stern | ||
1662 | warning */ | ||
1663 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, | ||
1664 | "Client asked for preference change with peer `%s', which is not connected!\n", | ||
1665 | GNUNET_i2s (&rcm->peer)); | ||
1666 | } | ||
1659 | cim.header.size = htons (sizeof (struct ConfigurationInfoMessage)); | 1667 | cim.header.size = htons (sizeof (struct ConfigurationInfoMessage)); |
1660 | cim.header.type = htons (GNUNET_MESSAGE_TYPE_CORE_CONFIGURATION_INFO); | 1668 | cim.header.type = htons (GNUNET_MESSAGE_TYPE_CORE_CONFIGURATION_INFO); |
1661 | cim.peer = rcm->peer; | 1669 | cim.peer = rcm->peer; |
1670 | cim.rim_id = rcm->rim_id; | ||
1662 | #if DEBUG_CORE_CLIENT | 1671 | #if DEBUG_CORE_CLIENT |
1663 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 1672 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
1664 | "Sending `%s' message to client.\n", "CONFIGURATION_INFO"); | 1673 | "Sending `%s' message to client.\n", "CONFIGURATION_INFO"); |
@@ -1782,7 +1791,7 @@ do_encrypt (struct Neighbour *n, | |||
1782 | &n->encrypt_key, | 1791 | &n->encrypt_key, |
1783 | iv, out)); | 1792 | iv, out)); |
1784 | GNUNET_STATISTICS_update (stats, gettext_noop ("# bytes encrypted"), size, GNUNET_NO); | 1793 | GNUNET_STATISTICS_update (stats, gettext_noop ("# bytes encrypted"), size, GNUNET_NO); |
1785 | #if DEBUG_CORE | 1794 | #if DEBUG_CORE > 2 |
1786 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 1795 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
1787 | "Encrypted %u bytes for `%4s' using key %u, IV %u\n", | 1796 | "Encrypted %u bytes for `%4s' using key %u, IV %u\n", |
1788 | (unsigned int) size, | 1797 | (unsigned int) size, |
@@ -2028,7 +2037,7 @@ process_encrypted_neighbour_queue (struct Neighbour *n) | |||
2028 | process_plaintext_neighbour_queue (n); | 2037 | process_plaintext_neighbour_queue (n); |
2029 | return; | 2038 | return; |
2030 | } | 2039 | } |
2031 | #if DEBUG_CORE | 2040 | #if DEBUG_CORE > 1 |
2032 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 2041 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
2033 | "Asking transport for transmission of %u bytes to `%4s' in next %llu ms\n", | 2042 | "Asking transport for transmission of %u bytes to `%4s' in next %llu ms\n", |
2034 | (unsigned int) m->size, | 2043 | (unsigned int) m->size, |
@@ -2099,7 +2108,7 @@ do_decrypt (struct Neighbour *n, | |||
2099 | gettext_noop ("# bytes decrypted"), | 2108 | gettext_noop ("# bytes decrypted"), |
2100 | size, | 2109 | size, |
2101 | GNUNET_NO); | 2110 | GNUNET_NO); |
2102 | #if DEBUG_CORE | 2111 | #if DEBUG_CORE > 1 |
2103 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 2112 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
2104 | "Decrypted %u bytes from `%4s' using key %u, IV %u\n", | 2113 | "Decrypted %u bytes from `%4s' using key %u, IV %u\n", |
2105 | (unsigned int) size, | 2114 | (unsigned int) size, |
@@ -2292,7 +2301,7 @@ select_messages (struct Neighbour *n, | |||
2292 | pos->do_transmit = GNUNET_YES; /* mark for transmission */ | 2301 | pos->do_transmit = GNUNET_YES; /* mark for transmission */ |
2293 | off += pos->size; | 2302 | off += pos->size; |
2294 | size -= pos->size; | 2303 | size -= pos->size; |
2295 | #if DEBUG_CORE | 2304 | #if DEBUG_CORE > 1 |
2296 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 2305 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
2297 | "Selecting message of size %u for transmission\n", | 2306 | "Selecting message of size %u for transmission\n", |
2298 | (unsigned int) pos->size); | 2307 | (unsigned int) pos->size); |
@@ -2300,7 +2309,7 @@ select_messages (struct Neighbour *n, | |||
2300 | } | 2309 | } |
2301 | else | 2310 | else |
2302 | { | 2311 | { |
2303 | #if DEBUG_CORE | 2312 | #if DEBUG_CORE > 1 |
2304 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 2313 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
2305 | "Not selecting message of size %u for transmission at this time (maximum is %u)\n", | 2314 | "Not selecting message of size %u for transmission at this time (maximum is %u)\n", |
2306 | (unsigned int) pos->size, | 2315 | (unsigned int) pos->size, |
@@ -2412,7 +2421,7 @@ batch_message (struct Neighbour *n, | |||
2412 | ret += pos->size; | 2421 | ret += pos->size; |
2413 | size -= pos->size; | 2422 | size -= pos->size; |
2414 | *priority += pos->priority; | 2423 | *priority += pos->priority; |
2415 | #if DEBUG_CORE | 2424 | #if DEBUG_CORE > 1 |
2416 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 2425 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
2417 | "Adding plaintext message of size %u with deadline %llu ms to batch\n", | 2426 | "Adding plaintext message of size %u with deadline %llu ms to batch\n", |
2418 | (unsigned int) pos->size, | 2427 | (unsigned int) pos->size, |
@@ -2431,7 +2440,7 @@ batch_message (struct Neighbour *n, | |||
2431 | } | 2440 | } |
2432 | pos = next; | 2441 | pos = next; |
2433 | } | 2442 | } |
2434 | #if DEBUG_CORE | 2443 | #if DEBUG_CORE > 1 |
2435 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 2444 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
2436 | "Deadline for message batch is %llu ms\n", | 2445 | "Deadline for message batch is %llu ms\n", |
2437 | GNUNET_TIME_absolute_get_remaining (*deadline).rel_value); | 2446 | GNUNET_TIME_absolute_get_remaining (*deadline).rel_value); |
@@ -2610,7 +2619,7 @@ process_plaintext_neighbour_queue (struct Neighbour *n) | |||
2610 | } | 2619 | } |
2611 | if (n->encrypted_head != NULL) | 2620 | if (n->encrypted_head != NULL) |
2612 | { | 2621 | { |
2613 | #if DEBUG_CORE | 2622 | #if DEBUG_CORE > 2 |
2614 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 2623 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
2615 | "Encrypted message queue for `%4s' is still full, delaying plaintext processing.\n", | 2624 | "Encrypted message queue for `%4s' is still full, delaying plaintext processing.\n", |
2616 | GNUNET_i2s(&n->peer)); | 2625 | GNUNET_i2s(&n->peer)); |
@@ -2628,7 +2637,7 @@ process_plaintext_neighbour_queue (struct Neighbour *n) | |||
2628 | &deadline, &retry_time, &priority); | 2637 | &deadline, &retry_time, &priority); |
2629 | if (used == sizeof (struct EncryptedMessage)) | 2638 | if (used == sizeof (struct EncryptedMessage)) |
2630 | { | 2639 | { |
2631 | #if DEBUG_CORE | 2640 | #if DEBUG_CORE > 1 |
2632 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 2641 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
2633 | "No messages selected for transmission to `%4s' at this time, will try again later.\n", | 2642 | "No messages selected for transmission to `%4s' at this time, will try again later.\n", |
2634 | GNUNET_i2s(&n->peer)); | 2643 | GNUNET_i2s(&n->peer)); |
@@ -2639,7 +2648,7 @@ process_plaintext_neighbour_queue (struct Neighbour *n) | |||
2639 | &retry_plaintext_processing, n); | 2648 | &retry_plaintext_processing, n); |
2640 | return; | 2649 | return; |
2641 | } | 2650 | } |
2642 | #if DEBUG_CORE_QUOTA | 2651 | #if DEBUG_CORE_QUOTA |
2643 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 2652 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
2644 | "Sending %u b/s as new limit to peer `%4s'\n", | 2653 | "Sending %u b/s as new limit to peer `%4s'\n", |
2645 | (unsigned int) ntohl (n->bw_in.value__), | 2654 | (unsigned int) ntohl (n->bw_in.value__), |
@@ -2661,7 +2670,7 @@ process_plaintext_neighbour_queue (struct Neighbour *n) | |||
2661 | em->iv_seed = ph->iv_seed; | 2670 | em->iv_seed = ph->iv_seed; |
2662 | derive_iv (&iv, &n->encrypt_key, ph->iv_seed, &n->peer); | 2671 | derive_iv (&iv, &n->encrypt_key, ph->iv_seed, &n->peer); |
2663 | /* encrypt */ | 2672 | /* encrypt */ |
2664 | #if DEBUG_HANDSHAKE | 2673 | #if DEBUG_HANDSHAKE |
2665 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 2674 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
2666 | "Encrypting %u bytes of plaintext messages for `%4s' for transmission in %llums.\n", | 2675 | "Encrypting %u bytes of plaintext messages for `%4s' for transmission in %llums.\n", |
2667 | (unsigned int) used - ENCRYPTED_HEADER_SIZE, | 2676 | (unsigned int) used - ENCRYPTED_HEADER_SIZE, |
@@ -3535,14 +3544,16 @@ handle_ping (struct Neighbour *n, | |||
3535 | if (0 != memcmp (&t.target, | 3544 | if (0 != memcmp (&t.target, |
3536 | &my_identity, sizeof (struct GNUNET_PeerIdentity))) | 3545 | &my_identity, sizeof (struct GNUNET_PeerIdentity))) |
3537 | { | 3546 | { |
3538 | char * sender; | 3547 | char sender[9]; |
3539 | GNUNET_asprintf(&sender, "%s",GNUNET_i2s (&n->peer)); | 3548 | char peer[9]; |
3540 | char * peer; | 3549 | |
3541 | GNUNET_asprintf(&peer, "%s",GNUNET_i2s (&t.target)); | 3550 | GNUNET_snprintf(sender, sizeof (sender), "%8s", GNUNET_i2s (&n->peer)); |
3542 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, | 3551 | GNUNET_snprintf(peer, sizeof (peer), "%8s", GNUNET_i2s (&t.target)); |
3543 | "Received PING from `%s' for different identity: I am `%s', PONG identity: `%s'\n",sender, GNUNET_i2s (&my_identity), peer ); | 3552 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, |
3544 | GNUNET_free (sender); | 3553 | _("Received PING from `%s' for different identity: I am `%s', PONG identity: `%s'\n"), |
3545 | GNUNET_free (peer); | 3554 | sender, |
3555 | GNUNET_i2s (&my_identity), | ||
3556 | peer); | ||
3546 | GNUNET_break_op (0); | 3557 | GNUNET_break_op (0); |
3547 | return; | 3558 | return; |
3548 | } | 3559 | } |
@@ -3609,7 +3620,7 @@ handle_pong (struct Neighbour *n, | |||
3609 | struct GNUNET_TRANSPORT_ATS_Information *mats; | 3620 | struct GNUNET_TRANSPORT_ATS_Information *mats; |
3610 | size_t size; | 3621 | size_t size; |
3611 | 3622 | ||
3612 | #if DEBUG_CORE | 3623 | #if DEBUG_HANDSHAKE |
3613 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 3624 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
3614 | "Core service receives `%s' response from `%4s'.\n", | 3625 | "Core service receives `%s' response from `%4s'.\n", |
3615 | "PONG", GNUNET_i2s (&n->peer)); | 3626 | "PONG", GNUNET_i2s (&n->peer)); |
@@ -4001,7 +4012,7 @@ deliver_message (void *cls, | |||
4001 | int dropped; | 4012 | int dropped; |
4002 | 4013 | ||
4003 | type = ntohs (m->type); | 4014 | type = ntohs (m->type); |
4004 | #if DEBUG_CORE | 4015 | #if DEBUG_CORE > 1 |
4005 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 4016 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
4006 | "Received encapsulated message of type %u and size %u from `%4s'\n", | 4017 | "Received encapsulated message of type %u and size %u from `%4s'\n", |
4007 | (unsigned int) type, | 4018 | (unsigned int) type, |
@@ -4258,7 +4269,7 @@ handle_transport_receive (void *cls, | |||
4258 | uint16_t size; | 4269 | uint16_t size; |
4259 | int changed; | 4270 | int changed; |
4260 | 4271 | ||
4261 | #if DEBUG_CORE | 4272 | #if DEBUG_CORE > 1 |
4262 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 4273 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
4263 | "Received message of type %u from `%4s', demultiplexing.\n", | 4274 | "Received message of type %u from `%4s', demultiplexing.\n", |
4264 | (unsigned int) ntohs (message->type), | 4275 | (unsigned int) ntohs (message->type), |
@@ -4323,7 +4334,7 @@ handle_transport_receive (void *cls, | |||
4323 | if ((n->status != PEER_STATE_KEY_RECEIVED) && | 4334 | if ((n->status != PEER_STATE_KEY_RECEIVED) && |
4324 | (n->status != PEER_STATE_KEY_CONFIRMED)) | 4335 | (n->status != PEER_STATE_KEY_CONFIRMED)) |
4325 | { | 4336 | { |
4326 | #if DEBUG_CORE | 4337 | #if DEBUG_CORE > 1 |
4327 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 4338 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
4328 | "Core service receives `%s' request from `%4s' but have not processed key; marking as pending.\n", | 4339 | "Core service receives `%s' request from `%4s' but have not processed key; marking as pending.\n", |
4329 | "PING", GNUNET_i2s (&n->peer)); | 4340 | "PING", GNUNET_i2s (&n->peer)); |
@@ -4346,7 +4357,7 @@ handle_transport_receive (void *cls, | |||
4346 | if ( (n->status != PEER_STATE_KEY_RECEIVED) && | 4357 | if ( (n->status != PEER_STATE_KEY_RECEIVED) && |
4347 | (n->status != PEER_STATE_KEY_CONFIRMED) ) | 4358 | (n->status != PEER_STATE_KEY_CONFIRMED) ) |
4348 | { | 4359 | { |
4349 | #if DEBUG_CORE | 4360 | #if DEBUG_CORE > 1 |
4350 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 4361 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
4351 | "Core service receives `%s' request from `%4s' but have not processed key; marking as pending.\n", | 4362 | "Core service receives `%s' request from `%4s' but have not processed key; marking as pending.\n", |
4352 | "PONG", GNUNET_i2s (&n->peer)); | 4363 | "PONG", GNUNET_i2s (&n->peer)); |
@@ -4412,7 +4423,7 @@ neighbour_quota_update (void *cls, | |||
4412 | uint64_t need_per_second; | 4423 | uint64_t need_per_second; |
4413 | unsigned int neighbour_count; | 4424 | unsigned int neighbour_count; |
4414 | 4425 | ||
4415 | #if DEBUG_CORE | 4426 | #if DEBUG_CORE > 1 |
4416 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 4427 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
4417 | "Neighbour quota update calculation running for peer `%4s'\n", | 4428 | "Neighbour quota update calculation running for peer `%4s'\n", |
4418 | GNUNET_i2s (&n->peer)); | 4429 | GNUNET_i2s (&n->peer)); |