diff options
Diffstat (limited to 'src/transport/plugin_transport_tcp.c')
-rw-r--r-- | src/transport/plugin_transport_tcp.c | 25 |
1 files changed, 0 insertions, 25 deletions
diff --git a/src/transport/plugin_transport_tcp.c b/src/transport/plugin_transport_tcp.c index c5682e16a..1ab6bac7e 100644 --- a/src/transport/plugin_transport_tcp.c +++ b/src/transport/plugin_transport_tcp.c | |||
@@ -39,10 +39,6 @@ | |||
39 | #include "gnunet_transport_plugin.h" | 39 | #include "gnunet_transport_plugin.h" |
40 | #include "transport.h" | 40 | #include "transport.h" |
41 | 41 | ||
42 | #define DEBUG_TCP GNUNET_EXTRA_LOGGING | ||
43 | |||
44 | #define DEBUG_TCP_NAT GNUNET_EXTRA_LOGGING | ||
45 | |||
46 | 42 | ||
47 | /** | 43 | /** |
48 | * How long until we give up on establishing an NAT connection? | 44 | * How long until we give up on establishing an NAT connection? |
@@ -764,11 +760,9 @@ do_transmit (void *cls, size_t size, void *buf) | |||
764 | plugin = session->plugin; | 760 | plugin = session->plugin; |
765 | if (buf == NULL) | 761 | if (buf == NULL) |
766 | { | 762 | { |
767 | #if DEBUG_TCP | ||
768 | GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, "tcp", | 763 | GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, "tcp", |
769 | "Timeout trying to transmit to peer `%4s', discarding message queue.\n", | 764 | "Timeout trying to transmit to peer `%4s', discarding message queue.\n", |
770 | GNUNET_i2s (&session->target)); | 765 | GNUNET_i2s (&session->target)); |
771 | #endif | ||
772 | /* timeout; cancel all messages that have already expired */ | 766 | /* timeout; cancel all messages that have already expired */ |
773 | hd = NULL; | 767 | hd = NULL; |
774 | tl = NULL; | 768 | tl = NULL; |
@@ -779,11 +773,9 @@ do_transmit (void *cls, size_t size, void *buf) | |||
779 | { | 773 | { |
780 | GNUNET_CONTAINER_DLL_remove (session->pending_messages_head, | 774 | GNUNET_CONTAINER_DLL_remove (session->pending_messages_head, |
781 | session->pending_messages_tail, pos); | 775 | session->pending_messages_tail, pos); |
782 | #if DEBUG_TCP | ||
783 | GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, "tcp", | 776 | GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, "tcp", |
784 | "Failed to transmit %u byte message to `%4s'.\n", | 777 | "Failed to transmit %u byte message to `%4s'.\n", |
785 | pos->message_size, GNUNET_i2s (&session->target)); | 778 | pos->message_size, GNUNET_i2s (&session->target)); |
786 | #endif | ||
787 | ret += pos->message_size; | 779 | ret += pos->message_size; |
788 | GNUNET_CONTAINER_DLL_insert_after (hd, tl, tl, pos); | 780 | GNUNET_CONTAINER_DLL_insert_after (hd, tl, tl, pos); |
789 | } | 781 | } |
@@ -849,10 +841,8 @@ do_transmit (void *cls, size_t size, void *buf) | |||
849 | } | 841 | } |
850 | GNUNET_assert (hd == NULL); | 842 | GNUNET_assert (hd == NULL); |
851 | GNUNET_assert (tl == NULL); | 843 | GNUNET_assert (tl == NULL); |
852 | #if DEBUG_TCP > 1 | ||
853 | GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, "tcp", "Transmitting %u bytes\n", | 844 | GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, "tcp", "Transmitting %u bytes\n", |
854 | ret); | 845 | ret); |
855 | #endif | ||
856 | GNUNET_STATISTICS_update (plugin->env->stats, | 846 | GNUNET_STATISTICS_update (plugin->env->stats, |
857 | gettext_noop ("# bytes currently in TCP buffers"), | 847 | gettext_noop ("# bytes currently in TCP buffers"), |
858 | -(int64_t) ret, GNUNET_NO); | 848 | -(int64_t) ret, GNUNET_NO); |
@@ -933,13 +923,11 @@ disconnect_session (struct Session *session) | |||
933 | 923 | ||
934 | while (NULL != (pm = session->pending_messages_head)) | 924 | while (NULL != (pm = session->pending_messages_head)) |
935 | { | 925 | { |
936 | #if DEBUG_TCP | ||
937 | GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, "tcp", | 926 | GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, "tcp", |
938 | pm->transmit_cont != | 927 | pm->transmit_cont != |
939 | NULL ? "Could not deliver message to `%4s'.\n" : | 928 | NULL ? "Could not deliver message to `%4s'.\n" : |
940 | "Could not deliver message to `%4s', notifying.\n", | 929 | "Could not deliver message to `%4s', notifying.\n", |
941 | GNUNET_i2s (&session->target)); | 930 | GNUNET_i2s (&session->target)); |
942 | #endif | ||
943 | GNUNET_STATISTICS_update (session->plugin->env->stats, | 931 | GNUNET_STATISTICS_update (session->plugin->env->stats, |
944 | gettext_noop ("# bytes currently in TCP buffers"), | 932 | gettext_noop ("# bytes currently in TCP buffers"), |
945 | -(int64_t) pm->message_size, GNUNET_NO); | 933 | -(int64_t) pm->message_size, GNUNET_NO); |
@@ -1268,10 +1256,8 @@ tcp_plugin_get_session (void *cls, | |||
1268 | GNUNET_CONTAINER_multihashmap_contains (plugin->nat_wait_conns, | 1256 | GNUNET_CONTAINER_multihashmap_contains (plugin->nat_wait_conns, |
1269 | &address->peer.hashPubKey))) | 1257 | &address->peer.hashPubKey))) |
1270 | { | 1258 | { |
1271 | #if DEBUG_TCP_NAT | ||
1272 | GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, "tcp", | 1259 | GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, "tcp", |
1273 | _("Found valid IPv4 NAT address (creating session)!\n")); | 1260 | _("Found valid IPv4 NAT address (creating session)!\n")); |
1274 | #endif | ||
1275 | session = create_session (plugin, &address->peer, NULL, GNUNET_YES); | 1261 | session = create_session (plugin, &address->peer, NULL, GNUNET_YES); |
1276 | session->addrlen = 0; | 1262 | session->addrlen = 0; |
1277 | session->addr = NULL; | 1263 | session->addr = NULL; |
@@ -1307,11 +1293,9 @@ tcp_plugin_get_session (void *cls, | |||
1307 | sa = GNUNET_CONNECTION_create_from_sockaddr (af, sb, sbs); | 1293 | sa = GNUNET_CONNECTION_create_from_sockaddr (af, sb, sbs); |
1308 | if (sa == NULL) | 1294 | if (sa == NULL) |
1309 | { | 1295 | { |
1310 | #if DEBUG_TCP | ||
1311 | GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, "tcp", | 1296 | GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, "tcp", |
1312 | "Failed to create connection to `%4s' at `%s'\n", | 1297 | "Failed to create connection to `%4s' at `%s'\n", |
1313 | GNUNET_i2s (&session->target), GNUNET_a2s (sb, sbs)); | 1298 | GNUNET_i2s (&session->target), GNUNET_a2s (sb, sbs)); |
1314 | #endif | ||
1315 | return NULL; | 1299 | return NULL; |
1316 | } | 1300 | } |
1317 | plugin->max_connections--; | 1301 | plugin->max_connections--; |
@@ -1680,12 +1664,9 @@ handle_tcp_nat_probe (void *cls, struct GNUNET_SERVER_Client *client, | |||
1680 | session->client = client; | 1664 | session->client = client; |
1681 | session->last_activity = GNUNET_TIME_absolute_get (); | 1665 | session->last_activity = GNUNET_TIME_absolute_get (); |
1682 | session->inbound = GNUNET_NO; | 1666 | session->inbound = GNUNET_NO; |
1683 | |||
1684 | #if DEBUG_TCP_NAT | ||
1685 | GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, "tcp", | 1667 | GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, "tcp", |
1686 | "Found address `%s' for incoming connection\n", | 1668 | "Found address `%s' for incoming connection\n", |
1687 | GNUNET_a2s (vaddr, alen)); | 1669 | GNUNET_a2s (vaddr, alen)); |
1688 | #endif | ||
1689 | switch (((const struct sockaddr *) vaddr)->sa_family) | 1670 | switch (((const struct sockaddr *) vaddr)->sa_family) |
1690 | { | 1671 | { |
1691 | case AF_INET: | 1672 | case AF_INET: |
@@ -1813,10 +1794,8 @@ handle_tcp_welcome (void *cls, struct GNUNET_SERVER_Client *client, | |||
1813 | } | 1794 | } |
1814 | else | 1795 | else |
1815 | { | 1796 | { |
1816 | #if DEBUG_TCP | ||
1817 | GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, "tcp", | 1797 | GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, "tcp", |
1818 | "Did not obtain TCP socket address for incoming connection\n"); | 1798 | "Did not obtain TCP socket address for incoming connection\n"); |
1819 | #endif | ||
1820 | } | 1799 | } |
1821 | GNUNET_CONTAINER_multihashmap_put(plugin->sessionmap, &wm->clientIdentity.hashPubKey, session, GNUNET_CONTAINER_MULTIHASHMAPOPTION_MULTIPLE); | 1800 | GNUNET_CONTAINER_multihashmap_put(plugin->sessionmap, &wm->clientIdentity.hashPubKey, session, GNUNET_CONTAINER_MULTIHASHMAPOPTION_MULTIPLE); |
1822 | inc_sessions (plugin, session, __LINE__); | 1801 | inc_sessions (plugin, session, __LINE__); |
@@ -1958,12 +1937,10 @@ handle_tcp_data (void *cls, struct GNUNET_SERVER_Client *client, | |||
1958 | } | 1937 | } |
1959 | else | 1938 | else |
1960 | { | 1939 | { |
1961 | #if DEBUG_TCP | ||
1962 | GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, "tcp", | 1940 | GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, "tcp", |
1963 | "Throttling receiving from `%s' for %llu ms\n", | 1941 | "Throttling receiving from `%s' for %llu ms\n", |
1964 | GNUNET_i2s (&session->target), | 1942 | GNUNET_i2s (&session->target), |
1965 | (unsigned long long) delay.rel_value); | 1943 | (unsigned long long) delay.rel_value); |
1966 | #endif | ||
1967 | GNUNET_SERVER_disable_receive_done_warning (client); | 1944 | GNUNET_SERVER_disable_receive_done_warning (client); |
1968 | session->receive_delay_task = | 1945 | session->receive_delay_task = |
1969 | GNUNET_SCHEDULER_add_delayed (delay, &delayed_done, session); | 1946 | GNUNET_SCHEDULER_add_delayed (delay, &delayed_done, session); |
@@ -1990,7 +1967,6 @@ disconnect_notify (void *cls, struct GNUNET_SERVER_Client *client) | |||
1990 | session = lookup_session_by_client (plugin, client); | 1967 | session = lookup_session_by_client (plugin, client); |
1991 | if (session == NULL) | 1968 | if (session == NULL) |
1992 | return; /* unknown, nothing to do */ | 1969 | return; /* unknown, nothing to do */ |
1993 | #if DEBUG_TCP | ||
1994 | GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, "tcp", | 1970 | GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, "tcp", |
1995 | "Destroying session of `%4s' with %s due to network-level disconnect.\n", | 1971 | "Destroying session of `%4s' with %s due to network-level disconnect.\n", |
1996 | GNUNET_i2s (&session->target), | 1972 | GNUNET_i2s (&session->target), |
@@ -1999,7 +1975,6 @@ disconnect_notify (void *cls, struct GNUNET_SERVER_Client *client) | |||
1999 | session->addr, | 1975 | session->addr, |
2000 | session->addrlen) : | 1976 | session->addrlen) : |
2001 | "*"); | 1977 | "*"); |
2002 | #endif | ||
2003 | GNUNET_STATISTICS_update (session->plugin->env->stats, | 1978 | GNUNET_STATISTICS_update (session->plugin->env->stats, |
2004 | gettext_noop | 1979 | gettext_noop |
2005 | ("# network-level TCP disconnect events"), 1, | 1980 | ("# network-level TCP disconnect events"), 1, |