gnunet-svn
[Top][All Lists]
Advanced

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

[GNUnet-SVN] r5578 - in GNUnet/src: applications/advertising transports


From: gnunet
Subject: [GNUnet-SVN] r5578 - in GNUnet/src: applications/advertising transports
Date: Fri, 31 Aug 2007 17:40:37 -0600 (MDT)

Author: grothoff
Date: 2007-08-31 17:40:37 -0600 (Fri, 31 Aug 2007)
New Revision: 5578

Modified:
   GNUnet/src/applications/advertising/advertising.c
   GNUnet/src/transports/tcp.c
   GNUnet/src/transports/udp.c
Log:
improving log messages

Modified: GNUnet/src/applications/advertising/advertising.c
===================================================================
--- GNUnet/src/applications/advertising/advertising.c   2007-08-31 20:46:42 UTC 
(rev 5577)
+++ GNUnet/src/applications/advertising/advertising.c   2007-08-31 23:40:37 UTC 
(rev 5578)
@@ -167,14 +167,14 @@
   if ((ntohs (msg->header.size) < sizeof (P2P_hello_MESSAGE)) ||
       (ntohs (msg->header.size) != P2P_hello_MESSAGE_size (msg)))
     {
-      GE_BREAK (ectx, 0);
+      GE_BREAK_OP (ectx, 0);
       return SYSERR;
     }
   identity->getPeerIdentity (&msg->publicKey, &foreignId);
   if (!equalsHashCode512 (&msg->senderIdentity.hashPubKey,
                           &foreignId.hashPubKey))
     {
-      GE_BREAK (ectx, 0);
+      GE_BREAK_OP (ectx, 0);
       return SYSERR;            /* public key and host hash do not match */
     }
   if (SYSERR == verifySig (&msg->senderIdentity,
@@ -192,7 +192,7 @@
               _
               ("HELLO message from `%s' has an invalid signature. 
Dropping.\n"),
               (char *) &enc);
-      GE_BREAK (ectx, 0);
+      GE_BREAK_OP (ectx, 0);
       return SYSERR;            /* message invalid */
     }
   if ((TIME_T) ntohl (msg->expirationTime) > TIME (NULL) + MAX_HELLO_EXPIRES)
@@ -201,7 +201,7 @@
               GE_WARNING | GE_BULK | GE_USER,
               _
               ("HELLO message has expiration too far in the future. 
Dropping.\n"));
-      GE_BREAK (ectx, 0);
+      GE_BREAK_OP (ectx, 0);
       return SYSERR;
     }
   if (SYSERR == transport->verifyhello (msg))

Modified: GNUnet/src/transports/tcp.c
===================================================================
--- GNUnet/src/transports/tcp.c 2007-08-31 20:46:42 UTC (rev 5577)
+++ GNUnet/src/transports/tcp.c 2007-08-31 23:40:37 UTC (rev 5578)
@@ -255,6 +255,7 @@
 static P2P_hello_MESSAGE *
 createhello ()
 {
+  static HostAddress last_addr;
   P2P_hello_MESSAGE *msg;
   HostAddress *haddr;
   unsigned short port;
@@ -289,12 +290,17 @@
               _("TCP: Could not determine my public IP address.\n"));
       return NULL;
     }
-  GE_LOG (ectx,
-          GE_DEBUG | GE_USER | GE_BULK,
-          "TCP uses IP address %u.%u.%u.%u.\n",
-          PRIP (ntohl (*(int *) &haddr->ip)));
   haddr->port = htons (port);
   haddr->reserved = htons (0);
+  if (0 != memcmp(haddr,
+                 &last_addr,
+                 sizeof(HostAddress))) {
+    GE_LOG (ectx,
+           GE_DEBUG | GE_USER | GE_BULK,
+           "TCP uses IP address %u.%u.%u.%u.\n",
+           PRIP (ntohl (*(int *) &haddr->ip)));
+    last_addr = *haddr;
+  }
   msg->senderAddressSize = htons (sizeof (HostAddress));
   msg->protocol = htons (TCP_PROTOCOL_NUMBER);
   msg->MTU = htonl (tcpAPI.mtu);

Modified: GNUnet/src/transports/udp.c
===================================================================
--- GNUnet/src/transports/udp.c 2007-08-31 20:46:42 UTC (rev 5577)
+++ GNUnet/src/transports/udp.c 2007-08-31 23:40:37 UTC (rev 5578)
@@ -263,6 +263,7 @@
 static P2P_hello_MESSAGE *
 createhello ()
 {
+  static HostAddress last_addr;
   P2P_hello_MESSAGE *msg;
   HostAddress *haddr;
   unsigned short port;
@@ -287,12 +288,17 @@
               _("UDP: Could not determine my public IP address.\n"));
       return NULL;
     }
-  GE_LOG (ectx,
-          GE_DEBUG | GE_USER | GE_BULK,
-          "UDP uses IP address %u.%u.%u.%u.\n",
-          PRIP (ntohl (*(int *) &haddr->ip)));
   haddr->port = htons (port);
   haddr->reserved = htons (0);
+  if (0 != memcmp(haddr,
+                 &last_addr,
+                 sizeof(HostAddress))) {
+    GE_LOG (ectx,
+           GE_DEBUG | GE_USER | GE_BULK,
+           "UDP uses IP address %u.%u.%u.%u.\n",
+           PRIP (ntohl (*(int *) &haddr->ip)));
+    last_addr = *haddr;
+  }
   msg->senderAddressSize = htons (sizeof (HostAddress));
   msg->protocol = htons (UDP_PROTOCOL_NUMBER);
   msg->MTU = htonl (udpAPI.mtu);





reply via email to

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