aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2015-02-09 15:30:55 +0000
committerChristian Grothoff <christian@grothoff.org>2015-02-09 15:30:55 +0000
commit0339602346feb236100964830eb0b61475aced41 (patch)
tree92d1438a5da67b5ae8d62fd973d55fdc61a1a721
parent5c7c6e303b1a46de5d8bab8eba7ec1e334c0b0eb (diff)
downloadgnunet-0339602346feb236100964830eb0b61475aced41.tar.gz
gnunet-0339602346feb236100964830eb0b61475aced41.zip
-minor indentation/logging fixes
-rw-r--r--src/transport/plugin_transport_tcp.c49
1 files changed, 27 insertions, 22 deletions
diff --git a/src/transport/plugin_transport_tcp.c b/src/transport/plugin_transport_tcp.c
index 3f20d30a5..f95e11f80 100644
--- a/src/transport/plugin_transport_tcp.c
+++ b/src/transport/plugin_transport_tcp.c
@@ -612,8 +612,8 @@ tcp_nat_port_map_callback (void *cls,
612 */ 612 */
613static const char * 613static const char *
614tcp_plugin_address_to_string (void *cls, 614tcp_plugin_address_to_string (void *cls,
615 const void *addr, 615 const void *addr,
616 size_t addrlen) 616 size_t addrlen)
617{ 617{
618 static char rbuf[INET6_ADDRSTRLEN + 12]; 618 static char rbuf[INET6_ADDRSTRLEN + 12];
619 char buf[INET6_ADDRSTRLEN]; 619 char buf[INET6_ADDRSTRLEN];
@@ -810,9 +810,9 @@ tcp_plugin_disconnect_session (void *cls,
810 LOG (GNUNET_ERROR_TYPE_DEBUG, 810 LOG (GNUNET_ERROR_TYPE_DEBUG,
811 "Disconnecting session of peer `%s' address `%s'\n", 811 "Disconnecting session of peer `%s' address `%s'\n",
812 GNUNET_i2s (&session->target), 812 GNUNET_i2s (&session->target),
813 tcp_plugin_address_to_string (NULL, 813 tcp_plugin_address_to_string (session->plugin,
814 session->address->address, 814 session->address->address,
815 session->address->address_length)); 815 session->address->address_length));
816 816
817 if (NULL != session->timeout_task) 817 if (NULL != session->timeout_task)
818 { 818 {
@@ -1166,9 +1166,12 @@ do_transmit (void *cls, size_t size, void *buf)
1166 session->bytes_in_queue -= pos->message_size; 1166 session->bytes_in_queue -= pos->message_size;
1167 GNUNET_assert(size >= pos->message_size); 1167 GNUNET_assert(size >= pos->message_size);
1168 LOG(GNUNET_ERROR_TYPE_DEBUG, 1168 LOG(GNUNET_ERROR_TYPE_DEBUG,
1169 "Transmitting message of type %u size %u\n", 1169 "Transmitting message of type %u size %u to %s\n",
1170 ntohs (((struct GNUNET_MessageHeader *) pos->msg)->type), 1170 ntohs (((struct GNUNET_MessageHeader *) pos->msg)->type),
1171 pos->message_size); 1171 pos->message_size,
1172 tcp_plugin_address_to_string (session->plugin,
1173 session->address->address,
1174 session->address->address_length));
1172 /* FIXME: this memcpy can be up to 7% of our total runtime */ 1175 /* FIXME: this memcpy can be up to 7% of our total runtime */
1173 memcpy (cbuf, pos->msg, pos->message_size); 1176 memcpy (cbuf, pos->msg, pos->message_size);
1174 cbuf += pos->message_size; 1177 cbuf += pos->message_size;
@@ -1414,7 +1417,7 @@ nat_connect_timeout (void *cls,
1414 LOG (GNUNET_ERROR_TYPE_DEBUG, 1417 LOG (GNUNET_ERROR_TYPE_DEBUG,
1415 "NAT WAIT connection to `%4s' at `%s' could not be established, removing session\n", 1418 "NAT WAIT connection to `%4s' at `%s' could not be established, removing session\n",
1416 GNUNET_i2s (&session->target), 1419 GNUNET_i2s (&session->target),
1417 tcp_plugin_address_to_string (NULL, 1420 tcp_plugin_address_to_string (session->plugin,
1418 session->address->address, 1421 session->address->address,
1419 session->address->address_length)); 1422 session->address->address_length));
1420 tcp_plugin_disconnect_session (session->plugin, 1423 tcp_plugin_disconnect_session (session->plugin,
@@ -1524,7 +1527,7 @@ tcp_plugin_get_session (void *cls,
1524 addrlen = address->address_length; 1527 addrlen = address->address_length;
1525 LOG (GNUNET_ERROR_TYPE_DEBUG, 1528 LOG (GNUNET_ERROR_TYPE_DEBUG,
1526 "Trying to get session for `%s' address of peer `%s'\n", 1529 "Trying to get session for `%s' address of peer `%s'\n",
1527 tcp_plugin_address_to_string (NULL, 1530 tcp_plugin_address_to_string (plugin,
1528 address->address, 1531 address->address,
1529 address->address_length), 1532 address->address_length),
1530 GNUNET_i2s (&address->peer)); 1533 GNUNET_i2s (&address->peer));
@@ -1555,7 +1558,7 @@ tcp_plugin_get_session (void *cls,
1555 LOG (GNUNET_ERROR_TYPE_DEBUG, 1558 LOG (GNUNET_ERROR_TYPE_DEBUG,
1556 "Found existing session for `%s' address `%s' session %p\n", 1559 "Found existing session for `%s' address `%s' session %p\n",
1557 GNUNET_i2s (&address->peer), 1560 GNUNET_i2s (&address->peer),
1558 tcp_plugin_address_to_string (NULL, 1561 tcp_plugin_address_to_string (plugin,
1559 address->address, 1562 address->address,
1560 address->address_length), 1563 address->address_length),
1561 session); 1564 session);
@@ -1563,7 +1566,7 @@ tcp_plugin_get_session (void *cls,
1563 } 1566 }
1564 LOG (GNUNET_ERROR_TYPE_DEBUG, 1567 LOG (GNUNET_ERROR_TYPE_DEBUG,
1565 "Existing sessions did not match address `%s' or peer `%s'\n", 1568 "Existing sessions did not match address `%s' or peer `%s'\n",
1566 tcp_plugin_address_to_string (NULL, 1569 tcp_plugin_address_to_string (plugin,
1567 address->address, 1570 address->address,
1568 address->address_length), 1571 address->address_length),
1569 GNUNET_i2s (&address->peer)); 1572 GNUNET_i2s (&address->peer));
@@ -1755,7 +1758,7 @@ tcp_plugin_get_session (void *cls,
1755 LOG (GNUNET_ERROR_TYPE_DEBUG, 1758 LOG (GNUNET_ERROR_TYPE_DEBUG,
1756 "Creating new session for `%s' address `%s' session %p\n", 1759 "Creating new session for `%s' address `%s' session %p\n",
1757 GNUNET_i2s (&address->peer), 1760 GNUNET_i2s (&address->peer),
1758 tcp_plugin_address_to_string (NULL, 1761 tcp_plugin_address_to_string (plugin,
1759 address->address, 1762 address->address,
1760 address->address_length), 1763 address->address_length),
1761 session); 1764 session);
@@ -2190,8 +2193,9 @@ handle_tcp_nat_probe (void *cls,
2190 GNUNET_CONTAINER_multipeermap_put (plugin->sessionmap, &session->target, 2193 GNUNET_CONTAINER_multipeermap_put (plugin->sessionmap, &session->target,
2191 session, GNUNET_CONTAINER_MULTIHASHMAPOPTION_MULTIPLE); 2194 session, GNUNET_CONTAINER_MULTIHASHMAPOPTION_MULTIPLE);
2192 session->last_activity = GNUNET_TIME_absolute_get (); 2195 session->last_activity = GNUNET_TIME_absolute_get ();
2193 LOG(GNUNET_ERROR_TYPE_DEBUG, "Found address `%s' for incoming connection\n", 2196 LOG (GNUNET_ERROR_TYPE_DEBUG,
2194 GNUNET_a2s (vaddr, alen)); 2197 "Found address `%s' for incoming connection\n",
2198 GNUNET_a2s (vaddr, alen));
2195 switch (((const struct sockaddr *) vaddr)->sa_family) 2199 switch (((const struct sockaddr *) vaddr)->sa_family)
2196 { 2200 {
2197 case AF_INET: 2201 case AF_INET:
@@ -2272,10 +2276,10 @@ handle_tcp_welcome (void *cls,
2272 GNUNET_SERVER_receive_done (client, GNUNET_SYSERR); 2276 GNUNET_SERVER_receive_done (client, GNUNET_SYSERR);
2273 if (GNUNET_OK == GNUNET_SERVER_client_get_address (client, &vaddr, &alen)) 2277 if (GNUNET_OK == GNUNET_SERVER_client_get_address (client, &vaddr, &alen))
2274 { 2278 {
2275 LOG(GNUNET_ERROR_TYPE_INFO, 2279 LOG (GNUNET_ERROR_TYPE_INFO,
2276 "Received %s message from my own identity `%4s' on address `%s'\n", 2280 "Received %s message from my own identity `%4s' on address `%s'\n",
2277 "WELCOME", GNUNET_i2s (&wm->clientIdentity), 2281 "WELCOME", GNUNET_i2s (&wm->clientIdentity),
2278 GNUNET_a2s (vaddr, alen)); 2282 GNUNET_a2s (vaddr, alen));
2279 GNUNET_free(vaddr); 2283 GNUNET_free(vaddr);
2280 } 2284 }
2281 return; 2285 return;
@@ -2352,8 +2356,8 @@ handle_tcp_welcome (void *cls,
2352 GNUNET_HELLO_ADDRESS_INFO_INBOUND) 2356 GNUNET_HELLO_ADDRESS_INFO_INBOUND)
2353 ? " inbound" : "", 2357 ? " inbound" : "",
2354 session, 2358 session,
2355 tcp_plugin_address_to_string (NULL, 2359 tcp_plugin_address_to_string (plugin,
2356 (void *) session->address->address, 2360 session->address->address,
2357 session->address->address_length), 2361 session->address->address_length),
2358 client); 2362 client);
2359 GNUNET_free (vaddr); 2363 GNUNET_free (vaddr);
@@ -2524,8 +2528,9 @@ disconnect_notify (void *cls,
2524 LOG (GNUNET_ERROR_TYPE_DEBUG, 2528 LOG (GNUNET_ERROR_TYPE_DEBUG,
2525 "Destroying session of `%4s' with %s due to network-level disconnect.\n", 2529 "Destroying session of `%4s' with %s due to network-level disconnect.\n",
2526 GNUNET_i2s (&session->target), 2530 GNUNET_i2s (&session->target),
2527 tcp_plugin_address_to_string (session->plugin, session->address->address, 2531 tcp_plugin_address_to_string (session->plugin,
2528 session->address->address_length)); 2532 session->address->address,
2533 session->address->address_length));
2529 2534
2530 if (plugin->cur_connections == plugin->max_connections) 2535 if (plugin->cur_connections == plugin->max_connections)
2531 GNUNET_SERVER_resume (plugin->server); /* Resume server */ 2536 GNUNET_SERVER_resume (plugin->server); /* Resume server */