diff options
author | Bart Polot <bart@net.in.tum.de> | 2014-02-19 20:02:21 +0000 |
---|---|---|
committer | Bart Polot <bart@net.in.tum.de> | 2014-02-19 20:02:21 +0000 |
commit | 0d5922000f0483e5cc22bf7073a9d3384d08bc60 (patch) | |
tree | 0c9365f446626bbd8874bc465f9df1b4f7333a1b | |
parent | 5a497543c8699402dbf3df9d818864775b09c5a9 (diff) | |
download | gnunet-0d5922000f0483e5cc22bf7073a9d3384d08bc60.tar.gz gnunet-0d5922000f0483e5cc22bf7073a9d3384d08bc60.zip |
- revamp logging
-rw-r--r-- | src/mesh/gnunet-service-mesh_connection.c | 46 | ||||
-rw-r--r-- | src/mesh/gnunet-service-mesh_peer.c | 6 | ||||
-rw-r--r-- | src/mesh/gnunet-service-mesh_tunnel.c | 2 |
3 files changed, 22 insertions, 32 deletions
diff --git a/src/mesh/gnunet-service-mesh_connection.c b/src/mesh/gnunet-service-mesh_connection.c index b09858591..e2aab338b 100644 --- a/src/mesh/gnunet-service-mesh_connection.c +++ b/src/mesh/gnunet-service-mesh_connection.c | |||
@@ -1446,13 +1446,16 @@ build_path_from_peer_ids (struct GNUNET_PeerIdentity *peers, | |||
1446 | * | 1446 | * |
1447 | * @param message Message received. | 1447 | * @param message Message received. |
1448 | * @param peer Peer who sent the message. | 1448 | * @param peer Peer who sent the message. |
1449 | * @param hash Connection ID. | ||
1449 | */ | 1450 | */ |
1450 | static void | 1451 | static void |
1451 | log_message (const struct GNUNET_MessageHeader *message, | 1452 | log_message (const struct GNUNET_MessageHeader *message, |
1452 | const struct GNUNET_PeerIdentity *peer) | 1453 | const struct GNUNET_PeerIdentity *peer, |
1454 | const struct GNUNET_HashCode *hash) | ||
1453 | { | 1455 | { |
1454 | LOG (GNUNET_ERROR_TYPE_INFO, "<- %s from %s\n", | 1456 | LOG (GNUNET_ERROR_TYPE_INFO, "<- %s from %s on connection %s\n", |
1455 | GM_m2s (ntohs (message->type)), GNUNET_i2s (peer)); | 1457 | GM_m2s (ntohs (message->type)), GNUNET_i2s (peer), |
1458 | GNUNET_h2s (hash)); | ||
1456 | } | 1459 | } |
1457 | 1460 | ||
1458 | /******************************************************************************/ | 1461 | /******************************************************************************/ |
@@ -1483,8 +1486,6 @@ GMC_handle_create (void *cls, const struct GNUNET_PeerIdentity *peer, | |||
1483 | unsigned int own_pos; | 1486 | unsigned int own_pos; |
1484 | uint16_t size; | 1487 | uint16_t size; |
1485 | 1488 | ||
1486 | log_message (message, peer); | ||
1487 | |||
1488 | /* Check size */ | 1489 | /* Check size */ |
1489 | size = ntohs (message->size); | 1490 | size = ntohs (message->size); |
1490 | if (size < sizeof (struct GNUNET_MESH_ConnectionCreate)) | 1491 | if (size < sizeof (struct GNUNET_MESH_ConnectionCreate)) |
@@ -1511,9 +1512,9 @@ GMC_handle_create (void *cls, const struct GNUNET_PeerIdentity *peer, | |||
1511 | /* Get parameters */ | 1512 | /* Get parameters */ |
1512 | msg = (struct GNUNET_MESH_ConnectionCreate *) message; | 1513 | msg = (struct GNUNET_MESH_ConnectionCreate *) message; |
1513 | cid = &msg->cid; | 1514 | cid = &msg->cid; |
1515 | log_message (message, peer, cid); | ||
1514 | id = (struct GNUNET_PeerIdentity *) &msg[1]; | 1516 | id = (struct GNUNET_PeerIdentity *) &msg[1]; |
1515 | LOG (GNUNET_ERROR_TYPE_DEBUG, " connection %s (%s->).\n", | 1517 | LOG (GNUNET_ERROR_TYPE_DEBUG, " origin: %s\n", GNUNET_i2s (id)); |
1516 | GNUNET_h2s (cid), GNUNET_i2s (id)); | ||
1517 | 1518 | ||
1518 | /* Create connection */ | 1519 | /* Create connection */ |
1519 | c = connection_get (cid); | 1520 | c = connection_get (cid); |
@@ -1609,11 +1610,8 @@ GMC_handle_confirm (void *cls, const struct GNUNET_PeerIdentity *peer, | |||
1609 | enum MeshConnectionState oldstate; | 1610 | enum MeshConnectionState oldstate; |
1610 | int fwd; | 1611 | int fwd; |
1611 | 1612 | ||
1612 | log_message (message, peer); | ||
1613 | |||
1614 | msg = (struct GNUNET_MESH_ConnectionACK *) message; | 1613 | msg = (struct GNUNET_MESH_ConnectionACK *) message; |
1615 | LOG (GNUNET_ERROR_TYPE_DEBUG, " on connection %s\n", | 1614 | log_message (message, peer, &msg->cid); |
1616 | GNUNET_h2s (&msg->cid)); | ||
1617 | c = connection_get (&msg->cid); | 1615 | c = connection_get (&msg->cid); |
1618 | if (NULL == c) | 1616 | if (NULL == c) |
1619 | { | 1617 | { |
@@ -1735,9 +1733,8 @@ GMC_handle_broken (void* cls, | |||
1735 | struct MeshConnection *c; | 1733 | struct MeshConnection *c; |
1736 | int fwd; | 1734 | int fwd; |
1737 | 1735 | ||
1738 | log_message (message, id); | ||
1739 | |||
1740 | msg = (struct GNUNET_MESH_ConnectionBroken *) message; | 1736 | msg = (struct GNUNET_MESH_ConnectionBroken *) message; |
1737 | log_message (message, id, &msg->cid); | ||
1741 | LOG (GNUNET_ERROR_TYPE_DEBUG, " regarding %s\n", | 1738 | LOG (GNUNET_ERROR_TYPE_DEBUG, " regarding %s\n", |
1742 | GNUNET_i2s (&msg->peer1)); | 1739 | GNUNET_i2s (&msg->peer1)); |
1743 | LOG (GNUNET_ERROR_TYPE_DEBUG, " regarding %s\n", | 1740 | LOG (GNUNET_ERROR_TYPE_DEBUG, " regarding %s\n", |
@@ -1788,10 +1785,8 @@ GMC_handle_destroy (void *cls, const struct GNUNET_PeerIdentity *peer, | |||
1788 | struct MeshConnection *c; | 1785 | struct MeshConnection *c; |
1789 | int fwd; | 1786 | int fwd; |
1790 | 1787 | ||
1791 | log_message (message, peer); | ||
1792 | |||
1793 | msg = (struct GNUNET_MESH_ConnectionDestroy *) message; | 1788 | msg = (struct GNUNET_MESH_ConnectionDestroy *) message; |
1794 | LOG (GNUNET_ERROR_TYPE_DEBUG, " on connection %s\n", GNUNET_h2s (&msg->cid)); | 1789 | log_message (message, peer, &msg->cid); |
1795 | c = connection_get (&msg->cid); | 1790 | c = connection_get (&msg->cid); |
1796 | if (NULL == c) | 1791 | if (NULL == c) |
1797 | { | 1792 | { |
@@ -1851,6 +1846,8 @@ handle_mesh_encrypted (const struct GNUNET_PeerIdentity *peer, | |||
1851 | size_t size; | 1846 | size_t size; |
1852 | int fwd; | 1847 | int fwd; |
1853 | 1848 | ||
1849 | log_message (&msg->header, peer, &msg->cid); | ||
1850 | |||
1854 | /* Check size */ | 1851 | /* Check size */ |
1855 | size = ntohs (msg->header.size); | 1852 | size = ntohs (msg->header.size); |
1856 | if (size < | 1853 | if (size < |
@@ -1871,7 +1868,7 @@ handle_mesh_encrypted (const struct GNUNET_PeerIdentity *peer, | |||
1871 | return GNUNET_OK; | 1868 | return GNUNET_OK; |
1872 | } | 1869 | } |
1873 | 1870 | ||
1874 | LOG (GNUNET_ERROR_TYPE_INFO, " on connection %s\n", GMC_2s (c)); | 1871 | LOG (GNUNET_ERROR_TYPE_DEBUG, " connection %s\n", GMC_2s (c)); |
1875 | 1872 | ||
1876 | /* Check if origin is as expected */ | 1873 | /* Check if origin is as expected */ |
1877 | neighbor = get_prev_hop (c); | 1874 | neighbor = get_prev_hop (c); |
@@ -1973,6 +1970,8 @@ handle_mesh_kx (const struct GNUNET_PeerIdentity *peer, | |||
1973 | size_t size; | 1970 | size_t size; |
1974 | int fwd; | 1971 | int fwd; |
1975 | 1972 | ||
1973 | log_message (&msg->header, peer, &msg->cid); | ||
1974 | |||
1976 | /* Check size */ | 1975 | /* Check size */ |
1977 | size = ntohs (msg->header.size); | 1976 | size = ntohs (msg->header.size); |
1978 | if (size < | 1977 | if (size < |
@@ -2065,8 +2064,6 @@ int | |||
2065 | GMC_handle_encrypted (void *cls, const struct GNUNET_PeerIdentity *peer, | 2064 | GMC_handle_encrypted (void *cls, const struct GNUNET_PeerIdentity *peer, |
2066 | const struct GNUNET_MessageHeader *message) | 2065 | const struct GNUNET_MessageHeader *message) |
2067 | { | 2066 | { |
2068 | log_message (message, peer); | ||
2069 | |||
2070 | return handle_mesh_encrypted (peer, | 2067 | return handle_mesh_encrypted (peer, |
2071 | (struct GNUNET_MESH_Encrypted *)message); | 2068 | (struct GNUNET_MESH_Encrypted *)message); |
2072 | } | 2069 | } |
@@ -2086,8 +2083,6 @@ int | |||
2086 | GMC_handle_kx (void *cls, const struct GNUNET_PeerIdentity *peer, | 2083 | GMC_handle_kx (void *cls, const struct GNUNET_PeerIdentity *peer, |
2087 | const struct GNUNET_MessageHeader *message) | 2084 | const struct GNUNET_MessageHeader *message) |
2088 | { | 2085 | { |
2089 | log_message (message, peer); | ||
2090 | |||
2091 | return handle_mesh_kx (peer, | 2086 | return handle_mesh_kx (peer, |
2092 | (struct GNUNET_MESH_KX *) message); | 2087 | (struct GNUNET_MESH_KX *) message); |
2093 | } | 2088 | } |
@@ -2114,9 +2109,8 @@ GMC_handle_ack (void *cls, const struct GNUNET_PeerIdentity *peer, | |||
2114 | uint32_t ack; | 2109 | uint32_t ack; |
2115 | int fwd; | 2110 | int fwd; |
2116 | 2111 | ||
2117 | log_message (message, peer); | ||
2118 | |||
2119 | msg = (struct GNUNET_MESH_ACK *) message; | 2112 | msg = (struct GNUNET_MESH_ACK *) message; |
2113 | log_message (message, peer, &msg->cid); | ||
2120 | c = connection_get (&msg->cid); | 2114 | c = connection_get (&msg->cid); |
2121 | if (NULL == c) | 2115 | if (NULL == c) |
2122 | { | 2116 | { |
@@ -2188,9 +2182,8 @@ GMC_handle_poll (void *cls, const struct GNUNET_PeerIdentity *peer, | |||
2188 | uint32_t pid; | 2182 | uint32_t pid; |
2189 | int fwd; | 2183 | int fwd; |
2190 | 2184 | ||
2191 | log_message (message, peer); | ||
2192 | |||
2193 | msg = (struct GNUNET_MESH_Poll *) message; | 2185 | msg = (struct GNUNET_MESH_Poll *) message; |
2186 | log_message (message, peer, &msg->cid); | ||
2194 | c = connection_get (&msg->cid); | 2187 | c = connection_get (&msg->cid); |
2195 | if (NULL == c) | 2188 | if (NULL == c) |
2196 | { | 2189 | { |
@@ -2255,9 +2248,8 @@ GMC_handle_keepalive (void *cls, const struct GNUNET_PeerIdentity *peer, | |||
2255 | GNUNET_PEER_Id peer_id; | 2248 | GNUNET_PEER_Id peer_id; |
2256 | int fwd; | 2249 | int fwd; |
2257 | 2250 | ||
2258 | log_message (message, peer); | ||
2259 | |||
2260 | msg = (struct GNUNET_MESH_ConnectionKeepAlive *) message; | 2251 | msg = (struct GNUNET_MESH_ConnectionKeepAlive *) message; |
2252 | log_message (message, peer, &msg->cid); | ||
2261 | c = connection_get (&msg->cid); | 2253 | c = connection_get (&msg->cid); |
2262 | if (NULL == c) | 2254 | if (NULL == c) |
2263 | { | 2255 | { |
diff --git a/src/mesh/gnunet-service-mesh_peer.c b/src/mesh/gnunet-service-mesh_peer.c index 5029df2ee..7f74ad65b 100644 --- a/src/mesh/gnunet-service-mesh_peer.c +++ b/src/mesh/gnunet-service-mesh_peer.c | |||
@@ -1073,10 +1073,8 @@ GMP_queue_add (struct MeshPeer *peer, void *cls, uint16_t type, size_t size, | |||
1073 | int priority; | 1073 | int priority; |
1074 | int call_core; | 1074 | int call_core; |
1075 | 1075 | ||
1076 | LOG (GNUNET_ERROR_TYPE_INFO, | 1076 | LOG (GNUNET_ERROR_TYPE_INFO, "qq %s %s towards %s (size %u) on c %p (%s)\n", |
1077 | "queue add %s %s towards %s (size %u) on c %p (%s)\n", | 1077 | GM_m2s (type), GM_f2s (fwd), GMP_2s(peer), size, c, GMC_2s (c)); |
1078 | GM_f2s (fwd), GM_m2s (type), GMP_2s(peer), | ||
1079 | size, c, GMC_2s (c)); | ||
1080 | 1078 | ||
1081 | if (NULL == peer->connections) | 1079 | if (NULL == peer->connections) |
1082 | { | 1080 | { |
diff --git a/src/mesh/gnunet-service-mesh_tunnel.c b/src/mesh/gnunet-service-mesh_tunnel.c index 1d5b5c5d8..482a12ad7 100644 --- a/src/mesh/gnunet-service-mesh_tunnel.c +++ b/src/mesh/gnunet-service-mesh_tunnel.c | |||
@@ -1548,7 +1548,7 @@ handle_decrypted (struct MeshTunnel3 *t, | |||
1548 | uint16_t type; | 1548 | uint16_t type; |
1549 | 1549 | ||
1550 | type = ntohs (msgh->type); | 1550 | type = ntohs (msgh->type); |
1551 | LOG (GNUNET_ERROR_TYPE_INFO, "Got a %s message\n", GM_m2s (type)); | 1551 | LOG (GNUNET_ERROR_TYPE_INFO, "<- %s message\n", GM_m2s (type)); |
1552 | 1552 | ||
1553 | switch (type) | 1553 | switch (type) |
1554 | { | 1554 | { |