gnunet-svn
[Top][All Lists]
Advanced

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

[GNUnet-SVN] r1409 - in GNUnet/src: applications/advertising include ser


From: grothoff
Subject: [GNUnet-SVN] r1409 - in GNUnet/src: applications/advertising include server
Date: Tue, 12 Jul 2005 09:16:01 -0700 (PDT)

Author: grothoff
Date: 2005-07-12 09:15:56 -0700 (Tue, 12 Jul 2005)
New Revision: 1409

Modified:
   GNUnet/src/applications/advertising/advertising.c
   GNUnet/src/include/gnunet_core.h
   GNUnet/src/server/connection.c
Log:
MTU fix

Modified: GNUnet/src/applications/advertising/advertising.c
===================================================================
--- GNUnet/src/applications/advertising/advertising.c   2005-07-12 13:52:52 UTC 
(rev 1408)
+++ GNUnet/src/applications/advertising/advertising.c   2005-07-12 16:15:56 UTC 
(rev 1409)
@@ -267,7 +267,7 @@
 
   /* build message to send, ping must contain return-information,
      such as a selection of our HELOs... */
-  mtu = transport->getMTU(tsession->ttype);
+  mtu = transport->getMTU(tsession->ttype) - P2P_MESSAGE_OVERHEAD;
   if (mtu == 0)
     mtu = 2048; /* bound size */
   buffer = MALLOC(mtu);

Modified: GNUnet/src/include/gnunet_core.h
===================================================================
--- GNUnet/src/include/gnunet_core.h    2005-07-12 13:52:52 UTC (rev 1408)
+++ GNUnet/src/include/gnunet_core.h    2005-07-12 16:15:56 UTC (rev 1409)
@@ -49,6 +49,8 @@
  */
 #define EXTREME_PRIORITY 0xFFFFFF
 
+#define P2P_MESSAGE_OVERHEAD 32
+
 /**
  * Opaque handle for a session representation on the transport
  * layer side

Modified: GNUnet/src/server/connection.c
===================================================================
--- GNUnet/src/server/connection.c      2005-07-12 13:52:52 UTC (rev 1408)
+++ GNUnet/src/server/connection.c      2005-07-12 16:15:56 UTC (rev 1409)
@@ -2493,6 +2493,8 @@
  * Initialize this module.
  */
 void initConnection() {
+  GNUNET_ASSERT(P2P_MESSAGE_OVERHEAD
+               == sizeof(P2P_Message));
   ENTRY();
   scl_nextHead
     = NULL;
@@ -2771,6 +2773,11 @@
   int ret;
   P2P_Message * hdr;
 
+  GNUNET_ASSERT(tsession != NULL);
+  if (transport->getMTU(tsession->type) < size + sizeof(P2P_Message)) {
+    BREAK();
+    return SYSERR;
+  }
   buf = MALLOC(size + sizeof(P2P_Message));
   hdr = (P2P_Message*) buf;
   hdr->sequenceNumber = 0;





reply via email to

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