gnunet-svn
[Top][All Lists]
Advanced

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

[GNUnet-SVN] r3198 - in GNUnet: . src/applications/bootstrap_http


From: grothoff
Subject: [GNUnet-SVN] r3198 - in GNUnet: . src/applications/bootstrap_http
Date: Sun, 30 Jul 2006 21:07:32 -0700 (PDT)

Author: grothoff
Date: 2006-07-30 21:07:31 -0700 (Sun, 30 Jul 2006)
New Revision: 3198

Modified:
   GNUnet/src/applications/bootstrap_http/http.c
   GNUnet/todo
Log:
towards compiling bootstrap

Modified: GNUnet/src/applications/bootstrap_http/http.c
===================================================================
--- GNUnet/src/applications/bootstrap_http/http.c       2006-07-31 03:58:25 UTC 
(rev 3197)
+++ GNUnet/src/applications/bootstrap_http/http.c       2006-07-31 04:07:31 UTC 
(rev 3198)
@@ -1,6 +1,6 @@
 /*
      This file is part of GNUnet.
-     (C) 2001, 2002, 2003, 2004, 2005 Christian Grothoff (and other 
contributing authors)
+     (C) 2001, 2002, 2003, 2004, 2005, 2006 Christian Grothoff (and other 
contributing authors)
 
      GNUnet is free software; you can redistribute it and/or modify
      it under the terms of the GNU General Public License as published
@@ -21,8 +21,10 @@
 /**
  * @file bootstrap_http/http.c
  * @brief HOSTLISTURL support.  Downloads hellos via http.
+ * @author Christian Grothoff
  *
- * @author Christian Grothoff
+ * TODO: avoid busy-sleep-waiting (use select!); maybe 
+ *       change to use libwww!?
  */
 
 #include "platform.h"
@@ -107,9 +109,10 @@
   else {
     port = atoi(hostname + curpos + 1);
     if (!port) {
-       GE_LOG(ectx, GE_WARNING | GE_BULK | GE_USER,
-               _("Invalid port \"%s\" in hostlist specification, trying port 
%d.\n"),
-               TCP_HTTP_PORT);
+      GE_LOG(ectx,
+            GE_WARNING | GE_BULK | GE_USER,
+            _("Invalid port \"%s\" in hostlist specification, trying port 
%d.\n"),
+            TCP_HTTP_PORT);
        port = TCP_HTTP_PORT;
     }
   }
@@ -153,14 +156,18 @@
   if (CONNECT(sock,
              (struct sockaddr*)&soaddr,
              sizeof(soaddr)) < 0) {
-    GE_LOG(ectx, GE_WARNING | GE_BULK | GE_USER,
-       _("`%s' to `%s' failed at %s:%d with error: %s\n"),
-       "connect",
-       hostname,
-       __FILE__, __LINE__,
-       STRERROR(errno));
+    GE_LOG(ectx, 
+          GE_WARNING | GE_BULK | GE_USER,
+          _("`%s' to `%s' failed at %s:%d with error: %s\n"),
+          "connect",
+          hostname,
+          __FILE__, __LINE__,
+          STRERROR(errno));
     FREE(filename);
-    closefile(sock);
+    if (0 != CLOSE(sock))
+      GE_LOG_STRERROR(ectx,
+                     GE_WARNING | GE_BULK | GE_ADMIN, 
+                     "close");
     return;
   }
 
@@ -180,13 +187,16 @@
                             curpos);
   if (SYSERR == (int)curpos) {
     GE_LOG(ectx, GE_WARNING | GE_BULK | GE_USER,
-       _("`%s' to `%s' failed at %s:%d with error: %s\n"),
-       "send",
-       hostname,
-       __FILE__, __LINE__,
-       STRERROR(errno));
+          _("`%s' to `%s' failed at %s:%d with error: %s\n"),
+          "send",
+          hostname,
+          __FILE__, __LINE__,
+          STRERROR(errno));
     FREE(command);
-    closefile(sock);
+    if (0 != CLOSE(sock))
+      GE_LOG_STRERROR(ectx,
+                     GE_WARNING | GE_BULK | GE_ADMIN, 
+                     "close");
     return;
   }
   FREE(command);
@@ -215,10 +225,14 @@
   }
 
   if (curpos < 4) { /* we have not found it */
-    GE_LOG(ectx, GE_WARNING | GE_BULK | GE_USER,
-       _("Parsing HTTP response for URL `%s' failed.\n"),
-       url);
-    closefile(sock);
+    GE_LOG(ectx,
+          GE_WARNING | GE_BULK | GE_USER,
+          _("Parsing HTTP response for URL `%s' failed.\n"),
+          url);
+    if (0 != CLOSE(sock))
+      GE_LOG_STRERROR(ectx,
+                     GE_WARNING | GE_BULK | GE_ADMIN, 
+                     "close");
     return;
   }
 
@@ -264,7 +278,10 @@
   }
 
   FREE(buffer);
-  closefile(sock);
+  if (0 != CLOSE(sock))
+    GE_LOG_STRERROR(ectx,
+                   GE_WARNING | GE_BULK | GE_ADMIN, 
+                   "close");
 }
 
 
@@ -274,13 +291,16 @@
   int i;
   int cnt;
 
-  url = getConfigurationString("GNUNETD",
-                              "HOSTLISTURL");
-  if (url == NULL) {
-    GE_LOG(ectx, GE_DEBUG | GE_REQUEST | GE_USER,
-        "No hostlist URL specified in configuration, will not bootstrap.\n");
+  if (0 != GC_get_configuration_value_string(coreAPI->cfg,
+                                            "GNUNETD",
+                                            "HOSTLISTURL",
+                                            NULL,
+                                            &url)) {
+    GE_LOG(ectx,
+          GE_WARNING | GE_BULK | GE_USER,
+          "No hostlist URL specified in configuration, will not bootstrap.\n");
     return;
-  }
+  }  
 #if DEBUG_HTTP
   GE_LOG(ectx, GE_DEBUG | GE_REQUEST | GE_USER,
       "Trying to bootstrap with peers from `%s'\n",
@@ -320,32 +340,35 @@
 Bootstrap_ServiceAPI *
 provide_module_bootstrap(CoreAPIForApplication * capi) {
   static Bootstrap_ServiceAPI api;
-  char *proxy, *proxyPort;
+  char *proxy;
+  unsigned long long proxyPort;
   IPaddr ip;
 
   ectx = capi->ectx;
-  proxy = getConfigurationString("GNUNETD",
-                                "HTTP-PROXY");
-  if (proxy != NULL) {
+  if (0 == GC_get_configuration_value_string(capi->cfg,
+                                            "GNUNETD",
+                                            "HTTP-PROXY",
+                                            NULL,
+                                            &proxy)) {
     if (OK != get_host_by_name(ectx,
                               proxy,
                               &ip)) {
       GE_LOG(ectx, GE_ERROR | GE_BULK | GE_USER,
-         _("Could not resolve name of HTTP proxy `%s'. Trying without a 
proxy.\n"),
-         proxy);
+            _("Could not resolve name of HTTP proxy `%s'. Trying without a 
proxy.\n"),
+            proxy);
       theProxy.sin_addr.s_addr = 0;
     } else {
       memcpy(&theProxy.sin_addr.s_addr,
             &ip,
             sizeof(IPaddr));
-      proxyPort = getConfigurationString("GNUNETD",
-                                        "HTTP-PROXY-PORT");
-      if (proxyPort == NULL) {
-       theProxy.sin_port = htons(8080);
-      } else {
-       theProxy.sin_port = htons(atoi(proxyPort));
-       FREE(proxyPort);
-      }
+      GC_get_configuration_value_number(capi->cfg,
+                                       "GNUNETD",
+                                       "HTTP-PROXY-PORT",
+                                       1,
+                                       65535,
+                                       8080,
+                                       &proxyPort);
+      theProxy.sin_port = htons(proxyPort);
     }
     FREE(proxy);
   } else {

Modified: GNUnet/todo
===================================================================
--- GNUnet/todo 2006-07-31 03:58:25 UTC (rev 3197)
+++ GNUnet/todo 2006-07-31 04:07:31 UTC (rev 3198)
@@ -28,7 +28,8 @@
   * applications:
     + fragmentation, identity,  pingpong, session, transport,
       stats, topology_default, state, getoption, advertising compile
-    + for basics: bootstrap_http (370), traffic (720)
+    + bootstrap_http: maybe switch to libwww?
+    + for basics: traffic (720)
     + for fs: datastore (787), fs (18500), gap (2800), sqstore_sqlite (1375)
     + rest: sqstore_mysql, dht, chat, kvstore_sqlite, 
             sqstore_mysql, rpc, tbench, template, testbed, 





reply via email to

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