aboutsummaryrefslogtreecommitdiff
path: root/src/transport/plugin_transport_tcp.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/transport/plugin_transport_tcp.c')
-rw-r--r--src/transport/plugin_transport_tcp.c31
1 files changed, 14 insertions, 17 deletions
diff --git a/src/transport/plugin_transport_tcp.c b/src/transport/plugin_transport_tcp.c
index 04ba348b3..9c6535988 100644
--- a/src/transport/plugin_transport_tcp.c
+++ b/src/transport/plugin_transport_tcp.c
@@ -696,10 +696,9 @@ do_transmit (void *cls, size_t size, void *buf)
696 GNUNET_CONTAINER_DLL_remove (session->pending_messages_head, 696 GNUNET_CONTAINER_DLL_remove (session->pending_messages_head,
697 session->pending_messages_tail, pos); 697 session->pending_messages_tail, pos);
698 GNUNET_assert (size >= pos->message_size); 698 GNUNET_assert (size >= pos->message_size);
699 GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, 699 GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, "tcp",
700 "tcp", 700 "Transmitting message of type %u\n",
701 "Transmitting message of type %u\n", 701 ntohs (((struct GNUNET_MessageHeader *) pos->msg)->type));
702 ntohs (((struct GNUNET_MessageHeader*)pos->msg)->type));
703 /* FIXME: this memcpy can be up to 7% of our total runtime */ 702 /* FIXME: this memcpy can be up to 7% of our total runtime */
704 memcpy (cbuf, pos->msg, pos->message_size); 703 memcpy (cbuf, pos->msg, pos->message_size);
705 cbuf += pos->message_size; 704 cbuf += pos->message_size;
@@ -1002,7 +1001,7 @@ tcp_plugin_send (void *cls, const struct GNUNET_PeerIdentity *target,
1002 { 1001 {
1003 if (addrlen == sizeof (struct IPv6TcpAddress)) 1002 if (addrlen == sizeof (struct IPv6TcpAddress))
1004 { 1003 {
1005 GNUNET_assert (NULL != addr); /* make static analysis happy */ 1004 GNUNET_assert (NULL != addr); /* make static analysis happy */
1006 t6 = addr; 1005 t6 = addr;
1007 af = AF_INET6; 1006 af = AF_INET6;
1008 memset (&a6, 0, sizeof (a6)); 1007 memset (&a6, 0, sizeof (a6));
@@ -1019,7 +1018,7 @@ tcp_plugin_send (void *cls, const struct GNUNET_PeerIdentity *target,
1019 } 1018 }
1020 else if (addrlen == sizeof (struct IPv4TcpAddress)) 1019 else if (addrlen == sizeof (struct IPv4TcpAddress))
1021 { 1020 {
1022 GNUNET_assert (NULL != addr); /* make static analysis happy */ 1021 GNUNET_assert (NULL != addr); /* make static analysis happy */
1023 t4 = addr; 1022 t4 = addr;
1024 af = AF_INET; 1023 af = AF_INET;
1025 memset (&a4, 0, sizeof (a4)); 1024 memset (&a4, 0, sizeof (a4));
@@ -1073,7 +1072,7 @@ tcp_plugin_send (void *cls, const struct GNUNET_PeerIdentity *target,
1073 1072
1074 /* append pm to pending_messages list */ 1073 /* append pm to pending_messages list */
1075 GNUNET_CONTAINER_DLL_insert_tail (session->pending_messages_head, 1074 GNUNET_CONTAINER_DLL_insert_tail (session->pending_messages_head,
1076 session->pending_messages_tail, pm); 1075 session->pending_messages_tail, pm);
1077 1076
1078 GNUNET_assert (GNUNET_CONTAINER_multihashmap_put 1077 GNUNET_assert (GNUNET_CONTAINER_multihashmap_put
1079 (plugin->nat_wait_conns, &target->hashPubKey, session, 1078 (plugin->nat_wait_conns, &target->hashPubKey, session,
@@ -1129,16 +1128,14 @@ tcp_plugin_send (void *cls, const struct GNUNET_PeerIdentity *target,
1129 /* check if session is valid */ 1128 /* check if session is valid */
1130 struct Session *ses = plugin->sessions; 1129 struct Session *ses = plugin->sessions;
1131 1130
1132 if (0 != memcmp (target, 1131 if (0 !=
1133 &session->target, 1132 memcmp (target, &session->target, sizeof (struct GNUNET_PeerIdentity)))
1134 sizeof (struct GNUNET_PeerIdentity)))
1135 { 1133 {
1136 GNUNET_break (0); 1134 GNUNET_break (0);
1137 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, 1135 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
1138 "Got session %p for `%s', but should be for peer `%s'!\n", 1136 "Got session %p for `%s', but should be for peer `%s'!\n",
1139 session, 1137 session, GNUNET_i2s (&session->target),
1140 GNUNET_i2s (&session->target), 1138 GNUNET_h2s (&target->hashPubKey));
1141 GNUNET_h2s (&target->hashPubKey));
1142 return -1; 1139 return -1;
1143 } 1140 }
1144 1141
@@ -1170,7 +1167,7 @@ tcp_plugin_send (void *cls, const struct GNUNET_PeerIdentity *target,
1170 1167
1171 /* append pm to pending_messages list */ 1168 /* append pm to pending_messages list */
1172 GNUNET_CONTAINER_DLL_insert_tail (session->pending_messages_head, 1169 GNUNET_CONTAINER_DLL_insert_tail (session->pending_messages_head,
1173 session->pending_messages_tail, pm); 1170 session->pending_messages_tail, pm);
1174#if DEBUG_TCP 1171#if DEBUG_TCP
1175 GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, "tcp", 1172 GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, "tcp",
1176 "Asked to transmit %u bytes to `%s', added message to list.\n", 1173 "Asked to transmit %u bytes to `%s', added message to list.\n",
@@ -1741,8 +1738,8 @@ handle_tcp_data (void *cls, struct GNUNET_SERVER_Client *client,
1741 distance.value = htonl (1); 1738 distance.value = htonl (1);
1742 delay = 1739 delay =
1743 plugin->env->receive (plugin->env->cls, &session->target, message, 1740 plugin->env->receive (plugin->env->cls, &session->target, message,
1744 (const struct GNUNET_ATS_Information *) 1741 (const struct GNUNET_ATS_Information *) &distance,
1745 &distance, 1, session, 1742 1, session,
1746 (GNUNET_YES == 1743 (GNUNET_YES ==
1747 session->inbound) ? NULL : session->connect_addr, 1744 session->inbound) ? NULL : session->connect_addr,
1748 (GNUNET_YES == 1745 (GNUNET_YES ==