aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/transport/gnunet-service-transport.c40
-rw-r--r--src/transport/plugin_transport_tcp.c1
2 files changed, 36 insertions, 5 deletions
diff --git a/src/transport/gnunet-service-transport.c b/src/transport/gnunet-service-transport.c
index 7c66011e3..7db99c006 100644
--- a/src/transport/gnunet-service-transport.c
+++ b/src/transport/gnunet-service-transport.c
@@ -23,9 +23,6 @@
23 * @brief low-level P2P messaging 23 * @brief low-level P2P messaging
24 * @author Christian Grothoff 24 * @author Christian Grothoff
25 * 25 *
26 * BUGS:
27 * - bi-directional nature of TCP is not exploited
28 *
29 * NOTE: 26 * NOTE:
30 * - This code uses 'GNUNET_a2s' for debug printing in many places, 27 * - This code uses 'GNUNET_a2s' for debug printing in many places,
31 * which is technically wrong since it assumes we have IP+Port 28 * which is technically wrong since it assumes we have IP+Port
@@ -3003,11 +3000,44 @@ handle_ping(void *cls, const struct GNUNET_MessageHeader *message,
3003 GNUNET_assert (GNUNET_OK == 3000 GNUNET_assert (GNUNET_OK ==
3004 GNUNET_CRYPTO_rsa_sign (my_private_key, 3001 GNUNET_CRYPTO_rsa_sign (my_private_key,
3005 &pong->purpose, &pong->signature)); 3002 &pong->purpose, &pong->signature));
3006
3007 n = find_neighbour(peer); 3003 n = find_neighbour(peer);
3008 if (n == NULL) 3004 if (n == NULL)
3009 n = setup_new_neighbour(peer); 3005 n = setup_new_neighbour(peer);
3010 /* broadcast 'PONG' to all available addresses */ 3006 /* first try reliable response transmission */
3007 rl = n->plugins;
3008 while (rl != NULL)
3009 {
3010 fal = rl->addresses;
3011 while (fal != NULL)
3012 {
3013 if (-1 != rl->plugin->api->send (rl->plugin->api->cls,
3014 peer,
3015 (const char*) pong,
3016 ntohs (pong->header.size),
3017 TRANSPORT_PONG_PRIORITY,
3018 HELLO_VERIFICATION_TIMEOUT,
3019 fal->addr,
3020 fal->addrlen,
3021 GNUNET_SYSERR,
3022 NULL, NULL))
3023 {
3024 /* done! */
3025 GNUNET_STATISTICS_update (stats,
3026 gettext_noop ("# PONGs unicast via reliable transport"),
3027 1,
3028 GNUNET_NO);
3029 GNUNET_free (pong);
3030 return GNUNET_OK;
3031 }
3032 fal = fal->next;
3033 }
3034 rl = rl->next;
3035 }
3036 /* no reliable method found, do multicast */
3037 GNUNET_STATISTICS_update (stats,
3038 gettext_noop ("# PONGs multicast to all available addresses"),
3039 1,
3040 GNUNET_NO);
3011 rl = n->plugins; 3041 rl = n->plugins;
3012 while (rl != NULL) 3042 while (rl != NULL)
3013 { 3043 {
diff --git a/src/transport/plugin_transport_tcp.c b/src/transport/plugin_transport_tcp.c
index 72c99b3ea..62c13ea64 100644
--- a/src/transport/plugin_transport_tcp.c
+++ b/src/transport/plugin_transport_tcp.c
@@ -1110,6 +1110,7 @@ handle_tcp_welcome (void *cls,
1110 GNUNET_SERVER_receive_done (client, GNUNET_SYSERR); 1110 GNUNET_SERVER_receive_done (client, GNUNET_SYSERR);
1111 return; 1111 return;
1112 } 1112 }
1113 session->last_activity = GNUNET_TIME_absolute_get ();
1113 session->expecting_welcome = GNUNET_NO; 1114 session->expecting_welcome = GNUNET_NO;
1114 GNUNET_SERVER_receive_done (client, GNUNET_OK); 1115 GNUNET_SERVER_receive_done (client, GNUNET_OK);
1115} 1116}