diff options
author | Bart Polot <bart@net.in.tum.de> | 2014-02-04 14:14:13 +0000 |
---|---|---|
committer | Bart Polot <bart@net.in.tum.de> | 2014-02-04 14:14:13 +0000 |
commit | eb8110afef63bd45d50a93e689d1da62500be064 (patch) | |
tree | 65e9732215c6f51b96a14e9f1a5c08bf702a8b8f | |
parent | 0066ca2f9086d3d4153849ed7a0edac5afb11f15 (diff) | |
download | gnunet-eb8110afef63bd45d50a93e689d1da62500be064.tar.gz gnunet-eb8110afef63bd45d50a93e689d1da62500be064.zip |
- refactor logging to allow for shorter log files
-rw-r--r-- | src/mesh/gnunet-service-mesh_channel.c | 11 | ||||
-rw-r--r-- | src/mesh/gnunet-service-mesh_connection.c | 83 | ||||
-rw-r--r-- | src/mesh/gnunet-service-mesh_peer.c | 2 | ||||
-rw-r--r-- | src/mesh/gnunet-service-mesh_tunnel.c | 4 |
4 files changed, 49 insertions, 51 deletions
diff --git a/src/mesh/gnunet-service-mesh_channel.c b/src/mesh/gnunet-service-mesh_channel.c index 06cf599d4..a77b06c42 100644 --- a/src/mesh/gnunet-service-mesh_channel.c +++ b/src/mesh/gnunet-service-mesh_channel.c | |||
@@ -1077,16 +1077,15 @@ rel_message_free (struct MeshReliableMessage *copy, int update_time) | |||
1077 | rel->expected_delay.rel_value_us += time.rel_value_us; | 1077 | rel->expected_delay.rel_value_us += time.rel_value_us; |
1078 | rel->expected_delay.rel_value_us /= 8; | 1078 | rel->expected_delay.rel_value_us /= 8; |
1079 | } | 1079 | } |
1080 | LOG (GNUNET_ERROR_TYPE_DEBUG, "!!! took %s\n", | 1080 | LOG (GNUNET_ERROR_TYPE_INFO, "!!! took %s, new delay %s\n", |
1081 | GNUNET_STRINGS_relative_time_to_string (time, GNUNET_NO)); | 1081 | GNUNET_STRINGS_relative_time_to_string (time, GNUNET_NO), |
1082 | LOG (GNUNET_ERROR_TYPE_DEBUG, "!!! new expected delay %s\n", | 1082 | GNUNET_STRINGS_relative_time_to_string (rel->expected_delay, |
1083 | GNUNET_STRINGS_relative_time_to_string (rel->expected_delay, | 1083 | GNUNET_NO)); |
1084 | GNUNET_NO)); | ||
1085 | rel->retry_timer = rel->expected_delay; | 1084 | rel->retry_timer = rel->expected_delay; |
1086 | } | 1085 | } |
1087 | else | 1086 | else |
1088 | { | 1087 | { |
1089 | LOG (GNUNET_ERROR_TYPE_DEBUG, "!!! batch free, ignoring timing\n"); | 1088 | LOG (GNUNET_ERROR_TYPE_INFO, "!!! batch free, ignoring timing\n"); |
1090 | } | 1089 | } |
1091 | rel->ch->pending_messages--; | 1090 | rel->ch->pending_messages--; |
1092 | if (NULL != copy->chq) | 1091 | if (NULL != copy->chq) |
diff --git a/src/mesh/gnunet-service-mesh_connection.c b/src/mesh/gnunet-service-mesh_connection.c index e0315ed7c..943a5058b 100644 --- a/src/mesh/gnunet-service-mesh_connection.c +++ b/src/mesh/gnunet-service-mesh_connection.c | |||
@@ -784,8 +784,8 @@ send_connection_ack (struct MeshConnection *connection, int fwd) | |||
784 | struct MeshTunnel3 *t; | 784 | struct MeshTunnel3 *t; |
785 | 785 | ||
786 | t = connection->t; | 786 | t = connection->t; |
787 | LOG (GNUNET_ERROR_TYPE_DEBUG, "Send connection %s ACK\n", | 787 | LOG (GNUNET_ERROR_TYPE_INFO, "Send %s ACK on connection %s\n", |
788 | GM_f2s (!fwd)); | 788 | GM_f2s (!fwd), GMC_2s (connection)); |
789 | GMP_queue_add (get_hop (connection, fwd), NULL, | 789 | GMP_queue_add (get_hop (connection, fwd), NULL, |
790 | GNUNET_MESSAGE_TYPE_MESH_CONNECTION_ACK, | 790 | GNUNET_MESSAGE_TYPE_MESH_CONNECTION_ACK, |
791 | sizeof (struct GNUNET_MESH_ConnectionACK), | 791 | sizeof (struct GNUNET_MESH_ConnectionACK), |
@@ -841,6 +841,8 @@ send_broken2 (struct GNUNET_HashCode *connection_id, | |||
841 | struct GNUNET_MESH_ConnectionBroken *msg; | 841 | struct GNUNET_MESH_ConnectionBroken *msg; |
842 | struct MeshPeer *neighbor; | 842 | struct MeshPeer *neighbor; |
843 | 843 | ||
844 | LOG (GNUNET_ERROR_TYPE_INFO, "Send BROKEN on connection %s\n", GMC_2s (c)); | ||
845 | |||
844 | msg = GNUNET_new (struct GNUNET_MESH_ConnectionBroken); | 846 | msg = GNUNET_new (struct GNUNET_MESH_ConnectionBroken); |
845 | msg->header.size = htons (sizeof (struct GNUNET_MESH_ConnectionBroken)); | 847 | msg->header.size = htons (sizeof (struct GNUNET_MESH_ConnectionBroken)); |
846 | msg->header.type = htons (GNUNET_MESSAGE_TYPE_MESH_CONNECTION_BROKEN); | 848 | msg->header.type = htons (GNUNET_MESSAGE_TYPE_MESH_CONNECTION_BROKEN); |
@@ -1447,6 +1449,22 @@ build_path_from_peer_ids (struct GNUNET_PeerIdentity *peers, | |||
1447 | return path; | 1449 | return path; |
1448 | } | 1450 | } |
1449 | 1451 | ||
1452 | |||
1453 | /** | ||
1454 | * Log receipt of message on stderr (INFO level). | ||
1455 | * | ||
1456 | * @param message Message received. | ||
1457 | * @param peer Peer who sent the message. | ||
1458 | */ | ||
1459 | static void | ||
1460 | log_message (const struct GNUNET_MessageHeader *message, | ||
1461 | const struct GNUNET_PeerIdentity *peer) | ||
1462 | { | ||
1463 | LOG (GNUNET_ERROR_TYPE_DEBUG, "\n\n"); | ||
1464 | LOG (GNUNET_ERROR_TYPE_INFO, "Got a %s message from %s\n", | ||
1465 | GM_m2s (ntohs (message->type)), GNUNET_i2s (peer)); | ||
1466 | } | ||
1467 | |||
1450 | /******************************************************************************/ | 1468 | /******************************************************************************/ |
1451 | /******************************** API ***********************************/ | 1469 | /******************************** API ***********************************/ |
1452 | /******************************************************************************/ | 1470 | /******************************************************************************/ |
@@ -1475,8 +1493,7 @@ GMC_handle_create (void *cls, const struct GNUNET_PeerIdentity *peer, | |||
1475 | unsigned int own_pos; | 1493 | unsigned int own_pos; |
1476 | uint16_t size; | 1494 | uint16_t size; |
1477 | 1495 | ||
1478 | LOG (GNUNET_ERROR_TYPE_DEBUG, "\n\n"); | 1496 | log_message (message, peer); |
1479 | LOG (GNUNET_ERROR_TYPE_DEBUG, "Received a connection create msg\n"); | ||
1480 | 1497 | ||
1481 | /* Check size */ | 1498 | /* Check size */ |
1482 | size = ntohs (message->size); | 1499 | size = ntohs (message->size); |
@@ -1602,8 +1619,8 @@ GMC_handle_confirm (void *cls, const struct GNUNET_PeerIdentity *peer, | |||
1602 | enum MeshConnectionState oldstate; | 1619 | enum MeshConnectionState oldstate; |
1603 | int fwd; | 1620 | int fwd; |
1604 | 1621 | ||
1605 | LOG (GNUNET_ERROR_TYPE_DEBUG, "\n\n"); | 1622 | log_message (message, peer); |
1606 | LOG (GNUNET_ERROR_TYPE_DEBUG, "Received a connection ACK msg\n"); | 1623 | |
1607 | msg = (struct GNUNET_MESH_ConnectionACK *) message; | 1624 | msg = (struct GNUNET_MESH_ConnectionACK *) message; |
1608 | LOG (GNUNET_ERROR_TYPE_DEBUG, " on connection %s\n", | 1625 | LOG (GNUNET_ERROR_TYPE_DEBUG, " on connection %s\n", |
1609 | GNUNET_h2s (&msg->cid)); | 1626 | GNUNET_h2s (&msg->cid)); |
@@ -1728,8 +1745,8 @@ GMC_handle_broken (void* cls, | |||
1728 | struct MeshConnection *c; | 1745 | struct MeshConnection *c; |
1729 | int fwd; | 1746 | int fwd; |
1730 | 1747 | ||
1731 | LOG (GNUNET_ERROR_TYPE_DEBUG, | 1748 | log_message (message, id); |
1732 | "Received a CONNECTION BROKEN msg from %s\n", GNUNET_i2s (id)); | 1749 | |
1733 | msg = (struct GNUNET_MESH_ConnectionBroken *) message; | 1750 | msg = (struct GNUNET_MESH_ConnectionBroken *) message; |
1734 | LOG (GNUNET_ERROR_TYPE_DEBUG, " regarding %s\n", | 1751 | LOG (GNUNET_ERROR_TYPE_DEBUG, " regarding %s\n", |
1735 | GNUNET_i2s (&msg->peer1)); | 1752 | GNUNET_i2s (&msg->peer1)); |
@@ -1781,13 +1798,10 @@ GMC_handle_destroy (void *cls, const struct GNUNET_PeerIdentity *peer, | |||
1781 | struct MeshConnection *c; | 1798 | struct MeshConnection *c; |
1782 | int fwd; | 1799 | int fwd; |
1783 | 1800 | ||
1801 | log_message (message, peer); | ||
1802 | |||
1784 | msg = (struct GNUNET_MESH_ConnectionDestroy *) message; | 1803 | msg = (struct GNUNET_MESH_ConnectionDestroy *) message; |
1785 | LOG (GNUNET_ERROR_TYPE_DEBUG, | 1804 | LOG (GNUNET_ERROR_TYPE_DEBUG, " on connection %s\n", GNUNET_h2s (&msg->cid)); |
1786 | "Got a CONNECTION DESTROY message from %s\n", | ||
1787 | GNUNET_i2s (peer)); | ||
1788 | LOG (GNUNET_ERROR_TYPE_DEBUG, | ||
1789 | " for connection %s\n", | ||
1790 | GNUNET_h2s (&msg->cid)); | ||
1791 | c = connection_get (&msg->cid); | 1805 | c = connection_get (&msg->cid); |
1792 | if (NULL == c) | 1806 | if (NULL == c) |
1793 | { | 1807 | { |
@@ -1844,7 +1858,6 @@ handle_mesh_encrypted (const struct GNUNET_PeerIdentity *peer, | |||
1844 | GNUNET_PEER_Id peer_id; | 1858 | GNUNET_PEER_Id peer_id; |
1845 | uint32_t pid; | 1859 | uint32_t pid; |
1846 | uint32_t ttl; | 1860 | uint32_t ttl; |
1847 | uint16_t type; | ||
1848 | size_t size; | 1861 | size_t size; |
1849 | int fwd; | 1862 | int fwd; |
1850 | 1863 | ||
@@ -1857,10 +1870,6 @@ handle_mesh_encrypted (const struct GNUNET_PeerIdentity *peer, | |||
1857 | GNUNET_break_op (0); | 1870 | GNUNET_break_op (0); |
1858 | return GNUNET_OK; | 1871 | return GNUNET_OK; |
1859 | } | 1872 | } |
1860 | type = ntohs (msg->header.type); | ||
1861 | LOG (GNUNET_ERROR_TYPE_DEBUG, "\n\n"); | ||
1862 | LOG (GNUNET_ERROR_TYPE_DEBUG, "got a %s message (#%u) from %s\n", | ||
1863 | GM_m2s (type), ntohl (msg->pid), GNUNET_i2s (peer)); | ||
1864 | 1873 | ||
1865 | /* Check connection */ | 1874 | /* Check connection */ |
1866 | c = connection_get (&msg->cid); | 1875 | c = connection_get (&msg->cid); |
@@ -1872,7 +1881,7 @@ handle_mesh_encrypted (const struct GNUNET_PeerIdentity *peer, | |||
1872 | return GNUNET_OK; | 1881 | return GNUNET_OK; |
1873 | } | 1882 | } |
1874 | 1883 | ||
1875 | LOG (GNUNET_ERROR_TYPE_DEBUG, " on connection %s\n", GMC_2s (c)); | 1884 | LOG (GNUNET_ERROR_TYPE_INFO, " on connection %s\n", GMC_2s (c)); |
1876 | 1885 | ||
1877 | /* Check if origin is as expected */ | 1886 | /* Check if origin is as expected */ |
1878 | neighbor = get_prev_hop (c); | 1887 | neighbor = get_prev_hop (c); |
@@ -1972,7 +1981,6 @@ handle_mesh_kx (const struct GNUNET_PeerIdentity *peer, | |||
1972 | struct MeshPeer *neighbor; | 1981 | struct MeshPeer *neighbor; |
1973 | GNUNET_PEER_Id peer_id; | 1982 | GNUNET_PEER_Id peer_id; |
1974 | size_t size; | 1983 | size_t size; |
1975 | uint16_t type; | ||
1976 | int fwd; | 1984 | int fwd; |
1977 | 1985 | ||
1978 | /* Check size */ | 1986 | /* Check size */ |
@@ -1984,10 +1992,6 @@ handle_mesh_kx (const struct GNUNET_PeerIdentity *peer, | |||
1984 | GNUNET_break_op (0); | 1992 | GNUNET_break_op (0); |
1985 | return GNUNET_OK; | 1993 | return GNUNET_OK; |
1986 | } | 1994 | } |
1987 | type = ntohs (msg->header.type); | ||
1988 | LOG (GNUNET_ERROR_TYPE_DEBUG, "\n\n"); | ||
1989 | LOG (GNUNET_ERROR_TYPE_DEBUG, "got a %s message from %s\n", | ||
1990 | GM_m2s (type), GNUNET_i2s (peer)); | ||
1991 | 1995 | ||
1992 | /* Check connection */ | 1996 | /* Check connection */ |
1993 | c = connection_get (&msg->cid); | 1997 | c = connection_get (&msg->cid); |
@@ -2071,6 +2075,8 @@ int | |||
2071 | GMC_handle_encrypted (void *cls, const struct GNUNET_PeerIdentity *peer, | 2075 | GMC_handle_encrypted (void *cls, const struct GNUNET_PeerIdentity *peer, |
2072 | const struct GNUNET_MessageHeader *message) | 2076 | const struct GNUNET_MessageHeader *message) |
2073 | { | 2077 | { |
2078 | log_message (message, peer); | ||
2079 | |||
2074 | return handle_mesh_encrypted (peer, | 2080 | return handle_mesh_encrypted (peer, |
2075 | (struct GNUNET_MESH_Encrypted *)message); | 2081 | (struct GNUNET_MESH_Encrypted *)message); |
2076 | } | 2082 | } |
@@ -2090,6 +2096,8 @@ int | |||
2090 | GMC_handle_kx (void *cls, const struct GNUNET_PeerIdentity *peer, | 2096 | GMC_handle_kx (void *cls, const struct GNUNET_PeerIdentity *peer, |
2091 | const struct GNUNET_MessageHeader *message) | 2097 | const struct GNUNET_MessageHeader *message) |
2092 | { | 2098 | { |
2099 | log_message (message, peer); | ||
2100 | |||
2093 | return handle_mesh_kx (peer, | 2101 | return handle_mesh_kx (peer, |
2094 | (struct GNUNET_MESH_KX *) message); | 2102 | (struct GNUNET_MESH_KX *) message); |
2095 | } | 2103 | } |
@@ -2116,13 +2124,10 @@ GMC_handle_ack (void *cls, const struct GNUNET_PeerIdentity *peer, | |||
2116 | uint32_t ack; | 2124 | uint32_t ack; |
2117 | int fwd; | 2125 | int fwd; |
2118 | 2126 | ||
2119 | LOG (GNUNET_ERROR_TYPE_DEBUG, "\n\n"); | 2127 | log_message (message, peer); |
2120 | LOG (GNUNET_ERROR_TYPE_DEBUG, "Got an ACK packet from %s!\n", | ||
2121 | GNUNET_i2s (peer)); | ||
2122 | msg = (struct GNUNET_MESH_ACK *) message; | ||
2123 | 2128 | ||
2129 | msg = (struct GNUNET_MESH_ACK *) message; | ||
2124 | c = connection_get (&msg->cid); | 2130 | c = connection_get (&msg->cid); |
2125 | |||
2126 | if (NULL == c) | 2131 | if (NULL == c) |
2127 | { | 2132 | { |
2128 | GNUNET_STATISTICS_update (stats, "# ack on unknown connection", 1, | 2133 | GNUNET_STATISTICS_update (stats, "# ack on unknown connection", 1, |
@@ -2193,15 +2198,10 @@ GMC_handle_poll (void *cls, const struct GNUNET_PeerIdentity *peer, | |||
2193 | uint32_t pid; | 2198 | uint32_t pid; |
2194 | int fwd; | 2199 | int fwd; |
2195 | 2200 | ||
2196 | LOG (GNUNET_ERROR_TYPE_DEBUG, "\n\n"); | 2201 | log_message (message, peer); |
2197 | LOG (GNUNET_ERROR_TYPE_DEBUG, | ||
2198 | "Got a POLL message from %s!\n", | ||
2199 | GNUNET_i2s (peer)); | ||
2200 | 2202 | ||
2201 | msg = (struct GNUNET_MESH_Poll *) message; | 2203 | msg = (struct GNUNET_MESH_Poll *) message; |
2202 | |||
2203 | c = connection_get (&msg->cid); | 2204 | c = connection_get (&msg->cid); |
2204 | |||
2205 | if (NULL == c) | 2205 | if (NULL == c) |
2206 | { | 2206 | { |
2207 | GNUNET_STATISTICS_update (stats, "# poll on unknown connection", 1, | 2207 | GNUNET_STATISTICS_update (stats, "# poll on unknown connection", 1, |
@@ -2265,10 +2265,9 @@ GMC_handle_keepalive (void *cls, const struct GNUNET_PeerIdentity *peer, | |||
2265 | GNUNET_PEER_Id peer_id; | 2265 | GNUNET_PEER_Id peer_id; |
2266 | int fwd; | 2266 | int fwd; |
2267 | 2267 | ||
2268 | msg = (struct GNUNET_MESH_ConnectionKeepAlive *) message; | 2268 | log_message (message, peer); |
2269 | LOG (GNUNET_ERROR_TYPE_DEBUG, "got a keepalive packet from %s\n", | ||
2270 | GNUNET_i2s (peer)); | ||
2271 | 2269 | ||
2270 | msg = (struct GNUNET_MESH_ConnectionKeepAlive *) message; | ||
2272 | c = connection_get (&msg->cid); | 2271 | c = connection_get (&msg->cid); |
2273 | if (NULL == c) | 2272 | if (NULL == c) |
2274 | { | 2273 | { |
@@ -2824,7 +2823,7 @@ GMC_send_prebuilt_message (const struct GNUNET_MessageHeader *message, | |||
2824 | data = GNUNET_malloc (size); | 2823 | data = GNUNET_malloc (size); |
2825 | memcpy (data, message, size); | 2824 | memcpy (data, message, size); |
2826 | type = ntohs (message->type); | 2825 | type = ntohs (message->type); |
2827 | LOG (GNUNET_ERROR_TYPE_DEBUG, "Send %s (%u bytes) on connection %s\n", | 2826 | LOG (GNUNET_ERROR_TYPE_INFO, "Send %s (%u bytes) on connection %s\n", |
2828 | GM_m2s (type), size, GMC_2s (c)); | 2827 | GM_m2s (type), size, GMC_2s (c)); |
2829 | 2828 | ||
2830 | fc = fwd ? &c->fwd_fc : &c->bck_fc; | 2829 | fc = fwd ? &c->fwd_fc : &c->bck_fc; |
@@ -2982,7 +2981,9 @@ GMC_send_create (struct MeshConnection *connection) | |||
2982 | size = sizeof (struct GNUNET_MESH_ConnectionCreate); | 2981 | size = sizeof (struct GNUNET_MESH_ConnectionCreate); |
2983 | size += connection->path->length * sizeof (struct GNUNET_PeerIdentity); | 2982 | size += connection->path->length * sizeof (struct GNUNET_PeerIdentity); |
2984 | 2983 | ||
2985 | LOG (GNUNET_ERROR_TYPE_DEBUG, "Send connection create\n"); | 2984 | LOG (GNUNET_ERROR_TYPE_INFO, "Send %s (%u bytes) on connection %s\n", |
2985 | GM_m2s (GNUNET_MESSAGE_TYPE_MESH_CONNECTION_CREATE), | ||
2986 | size, GMC_2s (connection)); | ||
2986 | LOG (GNUNET_ERROR_TYPE_DEBUG, " C_P+ %p %u (create)\n", | 2987 | LOG (GNUNET_ERROR_TYPE_DEBUG, " C_P+ %p %u (create)\n", |
2987 | connection, connection->pending_messages); | 2988 | connection, connection->pending_messages); |
2988 | connection->pending_messages++; | 2989 | connection->pending_messages++; |
diff --git a/src/mesh/gnunet-service-mesh_peer.c b/src/mesh/gnunet-service-mesh_peer.c index 55c279c98..9a3623e7d 100644 --- a/src/mesh/gnunet-service-mesh_peer.c +++ b/src/mesh/gnunet-service-mesh_peer.c | |||
@@ -1073,7 +1073,7 @@ 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_DEBUG, | 1076 | LOG (GNUNET_ERROR_TYPE_INFO, |
1077 | "queue add %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", |
1078 | GM_f2s (fwd), GM_m2s (type), GMP_2s(peer), | 1078 | GM_f2s (fwd), GM_m2s (type), GMP_2s(peer), |
1079 | size, c, GMC_2s (c)); | 1079 | size, c, GMC_2s (c)); |
diff --git a/src/mesh/gnunet-service-mesh_tunnel.c b/src/mesh/gnunet-service-mesh_tunnel.c index e5ca08828..1d5b5c5d8 100644 --- a/src/mesh/gnunet-service-mesh_tunnel.c +++ b/src/mesh/gnunet-service-mesh_tunnel.c | |||
@@ -1548,9 +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_DEBUG, | 1551 | LOG (GNUNET_ERROR_TYPE_INFO, "Got a %s message\n", GM_m2s (type)); |
1552 | "Got a %s message!\n", | ||
1553 | GM_m2s (type)); | ||
1554 | 1552 | ||
1555 | switch (type) | 1553 | switch (type) |
1556 | { | 1554 | { |