gnunet-svn
[Top][All Lists]
Advanced

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

[GNUnet-SVN] r2260 - in GNUnet/src: applications/fs/ecrs applications/fs


From: grothoff
Subject: [GNUnet-SVN] r2260 - in GNUnet/src: applications/fs/ecrs applications/fs/tools include server util
Date: Sat, 19 Nov 2005 02:43:42 -0800 (PST)

Author: grothoff
Date: 2005-11-19 02:43:36 -0800 (Sat, 19 Nov 2005)
New Revision: 2260

Modified:
   GNUnet/src/applications/fs/ecrs/download.c
   GNUnet/src/applications/fs/tools/gnunet-download.c
   GNUnet/src/include/gnunet_util.h
   GNUnet/src/server/tcpserver.c
   GNUnet/src/util/io.c
   GNUnet/src/util/port.c
   GNUnet/src/util/tcpio.c
Log:
bug 977

Modified: GNUnet/src/applications/fs/ecrs/download.c
===================================================================
--- GNUnet/src/applications/fs/ecrs/download.c  2005-11-19 00:14:23 UTC (rev 
2259)
+++ GNUnet/src/applications/fs/ecrs/download.c  2005-11-19 10:43:36 UTC (rev 
2260)
@@ -41,7 +41,7 @@
 /**
  * After how many retries do we print a warning?
  */
-#define MAX_TRIES 50
+#define MAX_TRIES 500
 
 
 /* ****************** IO context **************** */

Modified: GNUnet/src/applications/fs/tools/gnunet-download.c
===================================================================
--- GNUnet/src/applications/fs/tools/gnunet-download.c  2005-11-19 00:14:23 UTC 
(rev 2259)
+++ GNUnet/src/applications/fs/tools/gnunet-download.c  2005-11-19 10:43:36 UTC 
(rev 2260)
@@ -28,6 +28,8 @@
 #include "gnunet_fsui_lib.h"
 
 
+static int verbose = NO;
+
 static Semaphore * signalFinished;
 
 /**
@@ -153,9 +155,7 @@
 
   switch (event->type) {
   case FSUI_download_progress:
-    if (YES == testConfigurationString("GNUNET-DOWNLOAD",
-                                      "VERBOSE",
-                                      "YES")) {
+    if (YES == verbose) {
       PRINTF(_("Download of file `%s' at "
               "%16llu out of %16llu bytes (%8.3f kbps)\n"),
             event->data.DownloadProgress.filename,
@@ -226,6 +226,7 @@
   if (SYSERR == initUtil(argc, argv, &parseOptions))
     return 0;
 
+  verbose = testConfigurationString("GNUNET-DOWNLOAD", "VERBOSE", "YES");
   fstring = getConfigurationString("GNUNET-DOWNLOAD",
                                   "URI");
   uri = ECRS_stringToUri(fstring);

Modified: GNUnet/src/include/gnunet_util.h
===================================================================
--- GNUnet/src/include/gnunet_util.h    2005-11-19 00:14:23 UTC (rev 2259)
+++ GNUnet/src/include/gnunet_util.h    2005-11-19 10:43:36 UTC (rev 2260)
@@ -1660,12 +1660,6 @@
 unsigned short getGNUnetPort(void);
 
 /**
- * Configuration: get the GNUnetd host where the client
- * should connect to (via TCP)
- */
-char * getGNUnetdHost(void);
-
-/**
  * Get a GNUnet TCP socket that is connected to gnunetd.
  */
 GNUNET_TCP_SOCKET * getClientSocket(void);

Modified: GNUnet/src/server/tcpserver.c
===================================================================
--- GNUnet/src/server/tcpserver.c       2005-11-19 00:14:23 UTC (rev 2259)
+++ GNUnet/src/server/tcpserver.c       2005-11-19 10:43:36 UTC (rev 2260)
@@ -607,7 +607,7 @@
        if (success == SYSERR) {
          ClientHandle ch
            = pos->next;
-         LOG_STRERROR(LOG_WARNING, "send");
+         LOG_STRERROR(LOG_INFO, "send");
          terminateClientConnection(pos);
          pos = ch;
          continue;

Modified: GNUnet/src/util/io.c
===================================================================
--- GNUnet/src/util/io.c        2005-11-19 00:14:23 UTC (rev 2259)
+++ GNUnet/src/util/io.c        2005-11-19 10:43:36 UTC (rev 2260)
@@ -215,7 +215,7 @@
 int SEND_NONBLOCKING(int s,
                     const void * buf,
                     size_t max,
-                    size_t *sent) {
+                    size_t * sent) {
   int flags;
 
   setBlocking(s, NO);

Modified: GNUnet/src/util/port.c
===================================================================
--- GNUnet/src/util/port.c      2005-11-19 00:14:23 UTC (rev 2259)
+++ GNUnet/src/util/port.c      2005-11-19 10:43:36 UTC (rev 2260)
@@ -29,9 +29,11 @@
  * Return the port-number (in host byte order)
  */
 unsigned short getGNUnetPort() {
-  unsigned short port;
+  static unsigned short port;
   const char *setting;
 
+  if (port != 0)
+    return port;
   if (testConfigurationString("GNUNETD",
                              "_MAGIC_",
                              "YES"))
@@ -53,15 +55,17 @@
 /**
  * Configuration: get the GNUnetd host where the client
  * should connect to (via TCP)
- * @return the name of the host, caller must free!
+ * @return the name of the host
  */
-char * getGNUnetdHost() {
-  char * res;
+static const char * getGNUnetdHost() {
+  static char * res;
 
+  if (res != NULL)
+    return res;
   res = getConfigurationString("NETWORK",
                               "HOST");
   if (res == NULL)
-    res = STRDUP("localhost");
+    res = "localhost";
   return res;
 }
 
@@ -70,7 +74,7 @@
  */
 GNUNET_TCP_SOCKET * getClientSocket() {
   GNUNET_TCP_SOCKET * sock;
-  char * host;
+  const char * host;
 
   sock = MALLOC(sizeof(GNUNET_TCP_SOCKET));
   host = getGNUnetdHost();
@@ -80,10 +84,8 @@
     LOG(LOG_ERROR,
        _("Could not connect to gnunetd.\n"));
     FREE(sock);
-    FREE(host);
     return NULL;
   }
-  FREE(host);
   return sock;
 }
 

Modified: GNUnet/src/util/tcpio.c
===================================================================
--- GNUnet/src/util/tcpio.c     2005-11-19 00:14:23 UTC (rev 2259)
+++ GNUnet/src/util/tcpio.c     2005-11-19 10:43:36 UTC (rev 2260)
@@ -40,7 +40,7 @@
 #include "gnunet_util.h"
 #include "platform.h"
 
-#define DEBUG_TCPIO 0
+#define DEBUG_TCPIO NO
 
 /**
  * Initialize a GNUnet client socket.





reply via email to

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