gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[GNUnet-SVN] r12794 - gnunet/src/transport


From: gnunet
Subject: [GNUnet-SVN] r12794 - gnunet/src/transport
Date: Wed, 1 Sep 2010 15:18:50 +0200

Author: nevans
Date: 2010-09-01 15:18:50 +0200 (Wed, 01 Sep 2010)
New Revision: 12794

Modified:
   gnunet/src/transport/gnunet-service-transport.c
   gnunet/src/transport/plugin_transport_tcp.c
   gnunet/src/transport/plugin_transport_udp.c
Log:
transport service hello reduction, klocwork fixes

Modified: gnunet/src/transport/gnunet-service-transport.c
===================================================================
--- gnunet/src/transport/gnunet-service-transport.c     2010-09-01 12:28:31 UTC 
(rev 12793)
+++ gnunet/src/transport/gnunet-service-transport.c     2010-09-01 13:18:50 UTC 
(rev 12794)
@@ -2792,6 +2792,11 @@
       n->piter = GNUNET_PEERINFO_iterate (peerinfo, peer,
                                          GNUNET_TIME_UNIT_FOREVER_REL,
                                          &add_hello_for_peer, n);
+
+      GNUNET_STATISTICS_update (stats,
+                                gettext_noop ("# HELLO's sent to new 
neighbors"),
+                                1,
+                                GNUNET_NO);
       transmit_to_peer (NULL, NULL, 0,
                        HELLO_ADDRESS_EXPIRATION,
                        (const char *) our_hello, GNUNET_HELLO_size(our_hello),
@@ -3258,8 +3263,14 @@
                                      &neighbour->id.hashPubKey,
                                      va,
                                      
GNUNET_CONTAINER_MULTIHASHMAPOPTION_MULTIPLE);
-  hello_size = GNUNET_HELLO_size(our_hello);
+
+  if (peer_address->validated != GNUNET_YES)
+    hello_size = GNUNET_HELLO_size(our_hello);
+  else
+    hello_size = 0;
+
   tsize = sizeof(struct TransportPingMessage) + hello_size;
+
   if (peer_address->addr != NULL)
     {
       slen = strlen (tp->short_name) + 1;
@@ -3273,7 +3284,9 @@
   ping.header.type = htons(GNUNET_MESSAGE_TYPE_TRANSPORT_PING);
   ping.challenge = htonl(va->challenge);
   memcpy(&ping.target, &neighbour->id, sizeof(struct GNUNET_PeerIdentity));
-  memcpy(message_buf, our_hello, hello_size);
+  if (peer_address->validated != GNUNET_YES)
+    memcpy(message_buf, our_hello, hello_size);
+
   if (peer_address->addr != NULL)
     {
       ping.header.size = htons(sizeof(struct TransportPingMessage) +
@@ -3307,6 +3320,13 @@
               "HELLO", hello_size,
               "PING");
 #endif
+  if (peer_address->validated != GNUNET_YES)
+    GNUNET_STATISTICS_update (stats,
+                              gettext_noop ("# PING+HELLO messages sent"),
+                              1,
+                              GNUNET_NO);
+
+
   GNUNET_STATISTICS_update (stats,
                            gettext_noop ("# PING messages sent for 
re-validation"),
                            1,

Modified: gnunet/src/transport/plugin_transport_tcp.c
===================================================================
--- gnunet/src/transport/plugin_transport_tcp.c 2010-09-01 12:28:31 UTC (rev 
12793)
+++ gnunet/src/transport/plugin_transport_tcp.c 2010-09-01 13:18:50 UTC (rev 
12794)
@@ -2043,7 +2043,6 @@
       return;
     }
 
-  port = 0;
   port_start = NULL;
   for (i = 0; i < sizeof(mybuf); i++)
     {

Modified: gnunet/src/transport/plugin_transport_udp.c
===================================================================
--- gnunet/src/transport/plugin_transport_udp.c 2010-09-01 12:28:31 UTC (rev 
12793)
+++ gnunet/src/transport/plugin_transport_udp.c 2010-09-01 13:18:50 UTC (rev 
12794)
@@ -978,7 +978,8 @@
               &((struct sockaddr_in6 *) addr)->sin6_addr,
               sizeof (struct in6_addr));
       GNUNET_assert(NULL != inet_ntop(AF_INET6, &t6.ipv6_addr, &buf[0], 
INET6_ADDRSTRLEN));
-      if ((plugin->bind_address != NULL) || ((plugin->bind6_address != NULL) 
&& (0 != strcmp(buf, plugin->bind_address))))
+      if (((plugin->bind_address != NULL) && (0 != strcmp(buf, 
plugin->bind_address)))
+          || ((plugin->bind6_address != NULL) && (0 != strcmp(buf, 
plugin->bind6_address))))
         {
           GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, "%s: Not notifying transport of 
address %s\n", "UDP", GNUNET_a2s (addr, addrlen));
           return GNUNET_OK;
@@ -1177,7 +1178,6 @@
       return;
     }
 
-  port = 0;
   port_start = NULL;
   for (i = 0; i < sizeof(mybuf); i++)
     {




reply via email to

[Prev in Thread] Current Thread [Next in Thread]