gnunet-svn
[Top][All Lists]
Advanced

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

[GNUnet-SVN] r1180 - in GNUnet: . src/server src/transports


From: grothoff
Subject: [GNUnet-SVN] r1180 - in GNUnet: . src/server src/transports
Date: Thu, 30 Jun 2005 15:14:21 -0700 (PDT)

Author: grothoff
Date: 2005-06-30 15:14:15 -0700 (Thu, 30 Jun 2005)
New Revision: 1180

Modified:
   GNUnet/INSTALL
   GNUnet/src/server/connection.c
   GNUnet/src/transports/tcp.c
   GNUnet/src/transports/udp.c
   GNUnet/todo
Log:
update

Modified: GNUnet/INSTALL
===================================================================
--- GNUnet/INSTALL      2005-06-30 21:48:41 UTC (rev 1179)
+++ GNUnet/INSTALL      2005-06-30 22:14:15 UTC (rev 1180)
@@ -1,16 +1,13 @@
-Installation Instructions
-*************************
+Copyright (C) 1994, 1995, 1996, 1999, 2000, 2001, 2002 Free Software
+Foundation, Inc.
 
-Copyright (C) 1994, 1995, 1996, 1999, 2000, 2001, 2002, 2004, 2005 Free
-Software Foundation, Inc.
-
-This file is free documentation; the Free Software Foundation gives
+   This file is free documentation; the Free Software Foundation gives
 unlimited permission to copy, distribute and modify it.
 
 Basic Installation
 ==================
 
-These are generic installation instructions.
+   These are generic installation instructions.
 
    The `configure' shell script attempts to guess correct values for
 various system-dependent variables used during compilation.  It uses
@@ -70,9 +67,9 @@
 Compilers and Options
 =====================
 
-Some systems require unusual options for compilation or linking that the
-`configure' script does not know about.  Run `./configure --help' for
-details on some of the pertinent environment variables.
+   Some systems require unusual options for compilation or linking that
+the `configure' script does not know about.  Run `./configure --help'
+for details on some of the pertinent environment variables.
 
    You can give `configure' initial values for configuration parameters
 by setting variables in the command line or in the environment.  Here
@@ -85,7 +82,7 @@
 Compiling For Multiple Architectures
 ====================================
 
-You can compile the package for more than one kind of computer at the
+   You can compile the package for more than one kind of computer at the
 same time, by placing the object files for each architecture in their
 own directory.  To do this, you must use a version of `make' that
 supports the `VPATH' variable, such as GNU `make'.  `cd' to the
@@ -102,19 +99,19 @@
 Installation Names
 ==================
 
-By default, `make install' will install the package's files in
+   By default, `make install' will install the package's files in
 `/usr/local/bin', `/usr/local/man', etc.  You can specify an
 installation prefix other than `/usr/local' by giving `configure' the
-option `--prefix=PREFIX'.
+option `--prefix=PATH'.
 
    You can specify separate installation prefixes for
 architecture-specific files and architecture-independent files.  If you
-give `configure' the option `--exec-prefix=PREFIX', the package will
-use PREFIX as the prefix for installing programs and libraries.
+give `configure' the option `--exec-prefix=PATH', the package will use
+PATH as the prefix for installing programs and libraries.
 Documentation and other data files will still use the regular prefix.
 
    In addition, if you use an unusual directory layout you can give
-options like `--bindir=DIR' to specify different values for particular
+options like `--bindir=PATH' to specify different values for particular
 kinds of files.  Run `configure --help' for a list of the directories
 you can set and what kinds of files go in them.
 
@@ -125,7 +122,7 @@
 Optional Features
 =================
 
-Some packages pay attention to `--enable-FEATURE' options to
+   Some packages pay attention to `--enable-FEATURE' options to
 `configure', where FEATURE indicates an optional part of the package.
 They may also pay attention to `--with-PACKAGE' options, where PACKAGE
 is something like `gnu-as' or `x' (for the X Window System).  The
@@ -140,11 +137,11 @@
 Specifying the System Type
 ==========================
 
-There may be some features `configure' cannot figure out automatically,
-but needs to determine by the type of machine the package will run on.
-Usually, assuming the package is built to be run on the _same_
-architectures, `configure' can figure that out, but if it prints a
-message saying it cannot guess the machine type, give it the
+   There may be some features `configure' cannot figure out
+automatically, but needs to determine by the type of machine the package
+will run on.  Usually, assuming the package is built to be run on the
+_same_ architectures, `configure' can figure that out, but if it prints
+a message saying it cannot guess the machine type, give it the
 `--build=TYPE' option.  TYPE can either be a short name for the system
 type, such as `sun4', or a canonical name which has the form:
 
@@ -170,9 +167,9 @@
 Sharing Defaults
 ================
 
-If you want to set default values for `configure' scripts to share, you
-can create a site shell script called `config.site' that gives default
-values for variables like `CC', `cache_file', and `prefix'.
+   If you want to set default values for `configure' scripts to share,
+you can create a site shell script called `config.site' that gives
+default values for variables like `CC', `cache_file', and `prefix'.
 `configure' looks for `PREFIX/share/config.site' if it exists, then
 `PREFIX/etc/config.site' if it exists.  Or, you can set the
 `CONFIG_SITE' environment variable to the location of the site script.
@@ -181,7 +178,7 @@
 Defining Variables
 ==================
 
-Variables not defined in a site shell script can be set in the
+   Variables not defined in a site shell script can be set in the
 environment passed to `configure'.  However, some packages may run
 configure again during the build, and the customized values of these
 variables may be lost.  In order to avoid this problem, you should set
@@ -189,18 +186,14 @@
 
      ./configure CC=/usr/local2/bin/gcc
 
-causes the specified `gcc' to be used as the C compiler (unless it is
-overridden in the site shell script).  Here is a another example:
+will cause the specified gcc to be used as the C compiler (unless it is
+overridden in the site shell script).
 
-     /bin/bash ./configure CONFIG_SHELL=/bin/bash
-
-Here the `CONFIG_SHELL=/bin/bash' operand causes subsequent
-configuration-related scripts to be executed by `/bin/bash'.
-
 `configure' Invocation
 ======================
 
-`configure' recognizes the following options to control how it operates.
+   `configure' recognizes the following options to control how it
+operates.
 
 `--help'
 `-h'

Modified: GNUnet/src/server/connection.c
===================================================================
--- GNUnet/src/server/connection.c      2005-06-30 21:48:41 UTC (rev 1179)
+++ GNUnet/src/server/connection.c      2005-06-30 22:14:15 UTC (rev 1180)
@@ -842,7 +842,6 @@
   char * plaintextMsg;
   void * encryptedMsg;
   cron_t expired;
-  int targetSBLEN;
   int headpos;
   int tailpos;
   int approxProb;
@@ -1108,16 +1107,28 @@
       }
     }
 
-  targetSBLEN = 0; /* how many entries in sendBuffer
-                     afterwards? */
   for (i=0;i<be->sendBufferSize;i++) {
     SendEntry * entry = be->sendBuffer[perm[i]];
     if (knapsackSolution[perm[i]] == YES) {
       int ret;
 
-      ret = entry->callback(&plaintextMsg[p],
-                           entry->closure,
-                           entry->len);
+      if (entry->callback == NULL) {
+       memcpy(&plaintextMsg[p],
+              entry->closure,
+              entry->len);
+       ret = OK;
+      } else { 
+       ret = entry->callback(&plaintextMsg[p],
+                             entry->closure,
+                             entry->len);
+       if (ret == OK) {
+         entry->callback = NULL;
+         entry->closure = MALLOC(entry->len);
+         memcpy(entry->closure,
+                &plaintextMsg[p],
+                entry->len);
+       }
+      }
       if (ret == SYSERR) {     
        /* should not happen if everything went well,
           add random padding instead */
@@ -1130,10 +1141,10 @@
          = htons(p2p_PROTO_NOISE);
        for (i=p+sizeof(p2p_HEADER);i<entry->len+p;i++)
          plaintextMsg[p] = (char) rand();
+       entry->callback = NULL;
+       entry->closure = NULL;
       }
       p += entry->len;
-      FREE(entry);
-      be->sendBuffer[perm[i]] = NULL;
     } else {
       int msgCap;
       int l = getCPULoad();
@@ -1159,26 +1170,15 @@
            (int) ((cronTime(NULL) - entry->transmissionTime) / cronSECONDS),
            remainingBufferSize);
 #endif
-       FREE(entry->closure);
+       FREENONNULL(entry->closure);
        FREE(entry);
        be->sendBuffer[perm[i]] = NULL;
        remainingBufferSize--;
-      } else
-       targetSBLEN++;
+      }
     }
   }
   FREE(perm);
-  FREE(knapsackSolution);
 
-  /* cleanup/compact sendBuffer */
-  j = 0;
-  for (i=0;i<be->sendBufferSize;i++)
-    if (be->sendBuffer[i] != NULL)
-      be->sendBuffer[j++] = be->sendBuffer[i];
-  GROW(be->sendBuffer,
-       be->sendBufferSize,
-       targetSBLEN);
-
   /* still room left? try callbacks! */
   pos = scl_nextHead;
   while (pos != NULL) {
@@ -1248,9 +1248,32 @@
        j += plen;
       }
     }
+    for (i=0;i<be->sendBufferSize;i++) {
+      SendEntry * entry = be->sendBuffer[i];
+      if (knapsackSolution[i] == YES) {
+       GNUNET_ASSERT(entry->callback == NULL);
+       FREENONNULL(entry->closure);
+       FREE(entry);
+       be->sendBuffer[i] = NULL;
+      } else if ( (entry->callback == NULL) &&
+                 (entry->closure == NULL) ) {
+       FREE(entry);
+       be->sendBuffer[i] = NULL;
+      }      
+    }
   }
+  FREE(knapsackSolution);
   FREE(encryptedMsg);
   FREE(plaintextMsg);
+
+  /* cleanup/compact sendBuffer */
+  j = 0;
+  for (i=0;i<be->sendBufferSize;i++)
+    if (be->sendBuffer[i] != NULL) 
+      be->sendBuffer[j++] = be->sendBuffer[i];    
+  GROW(be->sendBuffer,
+       be->sendBufferSize,
+       j);
 }
 
 /**

Modified: GNUnet/src/transports/tcp.c
===================================================================
--- GNUnet/src/transports/tcp.c 2005-06-30 21:48:41 UTC (rev 1179)
+++ GNUnet/src/transports/tcp.c 2005-06-30 22:14:15 UTC (rev 1180)
@@ -1225,7 +1225,7 @@
         size);
   mp->size = htons(size);
   mp->reserved = 0;
-  /* if we would have less than 2k in buffers,
+  /* if we would have less than TARGET_BUFFER_SIZE in buffers,
      do reliable send */
   if (((TCPSession*)tsession->internal)->wpos + size < TARGET_BUFFER_SIZE)
     ok = tcpDirectSendReliable(tsession->internal,

Modified: GNUnet/src/transports/udp.c
===================================================================
--- GNUnet/src/transports/udp.c 2005-06-30 21:48:41 UTC (rev 1179)
+++ GNUnet/src/transports/udp.c 2005-06-30 22:14:15 UTC (rev 1180)
@@ -26,6 +26,7 @@
 #include "gnunet_util.h"
 #include "gnunet_protocols.h"
 #include "gnunet_transport.h"
+#include "gnunet_stats_service.h"
 #include "platform.h"
 #include "ip.h"
 
@@ -84,6 +85,15 @@
 static CoreAPIForTransport * coreAPI;
 static TransportAPI udpAPI;
 
+static Stats_ServiceAPI * stats;
+
+static int stat_bytesReceived;
+
+static int stat_bytesSent;
+
+static int stat_bytesDropped;
+
+
 /**
  * thread that listens for inbound messages
  */
@@ -233,6 +243,9 @@
       break; /* die/shutdown */
     }
     incrementBytesReceived(size);
+    stats->change(stat_bytesReceived,
+                 size);
+
     if ((unsigned int)size <= sizeof(UDPMessage)) {
       LOG(LOG_INFO,
          _("Received invalid UDP message from %u.%u.%u.%u:%u, dropping.\n"),
@@ -466,6 +479,8 @@
                      (struct sockaddr*) &sin,
                      sizeof(sin))) {
     ok = OK;
+    stats->change(stat_bytesSent,
+                 ssize);
   } else {
     LOG(LOG_WARNING,
        _("Failed to send message of size %d via UDP to %u.%u.%u.%u:%u: %s\n"),
@@ -473,6 +488,8 @@
        PRIP(ntohl(*(int*)&sin.sin_addr)),
        ntohs(sin.sin_port),
        STRERROR(errno));
+    stats->change(stat_bytesDropped,
+                 ssize);
   }
   incrementBytesSent(ssize);
   FREE(msg);
@@ -617,6 +634,16 @@
 
   GNUNET_ASSERT(sizeof(UDPMessage) == 68);
   coreAPI = core;
+  stats = coreAPI->requestService("stats");
+  if (stats != NULL) {
+    stat_bytesReceived
+      = stats->create(_("# bytes received via UDP"));
+    stat_bytesSent
+      = stats->create(_("# bytes sent via UDP"));
+    stat_bytesDropped
+      = stats->create(_("# bytes dropped by UDP (outgoing)"));
+  }
+  
   MUTEX_CREATE(&configLock);
   reloadConfiguration();
   mtu = getConfigurationInt("UDP",
@@ -647,8 +674,10 @@
 }
 
 void donetransport_udp() {
+  coreAPI->releaseService(stats);
   MUTEX_DESTROY(&configLock);
   FREENONNULL(filteredNetworks_);
+  coreAPI = NULL;
 }
 
 /* end of udp.c */

Modified: GNUnet/todo
===================================================================
--- GNUnet/todo 2005-06-30 21:48:41 UTC (rev 1179)
+++ GNUnet/todo 2005-06-30 22:14:15 UTC (rev 1180)
@@ -5,8 +5,6 @@
      whilst gnunet-transport-check -p was able to
      connect to 4-6 peers at the same time!)
 - add stats
-- TCP send drops too much
-- connection should keep messages if transport dropped!
 
 
 





reply via email to

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