gnunet-svn
[Top][All Lists]
Advanced

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

[GNUnet-SVN] r11625 - gnunet/src/transport


From: gnunet
Subject: [GNUnet-SVN] r11625 - gnunet/src/transport
Date: Mon, 7 Jun 2010 09:51:28 +0200

Author: wachs
Date: 2010-06-07 09:51:28 +0200 (Mon, 07 Jun 2010)
New Revision: 11625

Modified:
   gnunet/src/transport/plugin_transport_http.c
   gnunet/src/transport/test_plugin_transport_http.c
Log:


Modified: gnunet/src/transport/plugin_transport_http.c
===================================================================
--- gnunet/src/transport/plugin_transport_http.c        2010-06-07 07:13:31 UTC 
(rev 11624)
+++ gnunet/src/transport/plugin_transport_http.c        2010-06-07 07:51:28 UTC 
(rev 11625)
@@ -828,7 +828,7 @@
   curl_easy_setopt(ses->curl_handle, CURLOPT_WRITEFUNCTION, 
send_write_callback);
   curl_easy_setopt(ses->curl_handle, CURLOPT_READDATA, ses);
   curl_easy_setopt(ses->curl_handle, CURLOPT_INFILESIZE_LARGE, (curl_off_t) 
msg->len);
-  curl_easy_setopt(ses->curl_handle, CURLOPT_TIMEOUT, (timeout.value / 1000 ));
+  curl_easy_setopt(ses->curl_handle, CURLOPT_TIMEOUT, (long) (timeout.value / 
1000 ));
   curl_easy_setopt(ses->curl_handle, CURLOPT_CONNECTTIMEOUT, 
HTTP_CONNECT_TIMEOUT);
 
   mret = curl_multi_add_handle(multi_handle, ses->curl_handle);

Modified: gnunet/src/transport/test_plugin_transport_http.c
===================================================================
--- gnunet/src/transport/test_plugin_transport_http.c   2010-06-07 07:13:31 UTC 
(rev 11624)
+++ gnunet/src/transport/test_plugin_transport_http.c   2010-06-07 07:51:28 UTC 
(rev 11625)
@@ -39,7 +39,7 @@
 #include "transport.h"
 #include <curl/curl.h>
 
-#define VERBOSE GNUNET_NO
+#define VERBOSE GNUNET_YES
 #define DEBUG GNUNET_NO
 #define DEBUG_CURL GNUNET_NO
 
@@ -450,11 +450,16 @@
                     }
                   else
                     {
-                    GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Send completed with 
code %u\n", res->data_size);
+                    GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Send completed 
%u\n", res->data_size);
                     /* sending completed */
                     }
-                  if ( (cls == &testtransfer_no_ident) && 
(res->http_result_code==404) && (res->data_size==208))
+                  if (cls == &testtransfer_no_ident)
+                  {
+                    if  ((res->http_result_code==404) && (res->data_size==208))
                       res->test_failed = GNUNET_NO;
+                    else
+                      res->test_failed = GNUNET_YES;
+                  }
 
                   curl_easy_cleanup(curl_handle);
                   curl_handle=NULL;
@@ -721,9 +726,11 @@
   struct Plugin_Address * cur;
   struct Plugin_Address * tmp;
   const char * addr_str;
+  char * host_str;
   unsigned int count_str_addr;
   unsigned int suggest_res;
   unsigned int res;
+  long long unsigned int port;
 
   fail_pretty_printer = GNUNET_YES;
   fail_notify_address = GNUNET_YES;
@@ -803,6 +810,8 @@
     GNUNET_free ((char *) addr_str);
     addr_head=tmp;
   }
+
+
   GNUNET_assert (fail_pretty_printer_count==fail_notify_address_count);
   GNUNET_assert (fail_pretty_printer_count==count_str_addr);
   fail_pretty_printer=GNUNET_NO;
@@ -838,12 +847,35 @@
   testtransfer_no_ident.size=2048;
   testtransfer_no_ident.test_failed = GNUNET_YES;
 
+
+  if ((GNUNET_OK !=
+      GNUNET_CONFIGURATION_get_value_number (cfg,
+                                             "transport-http",
+                                             "PORT",
+                                             &port)) ||
+     (port > 65535) )
+  {
+    GNUNET_log_from (GNUNET_ERROR_TYPE_ERROR,
+                     "http",
+                     _
+                     ("Require valid port number for transport plugin `%s' in 
configuration!\n"),
+                     "transport-http");
+  }
+
   /* Connecting to peer without identification */
-  res = send_data (msg, &testtransfer_no_ident, "http://localhost:12389/";);
+  host_str = GNUNET_malloc (strlen ("http://localhost:12389/";));
+  GNUNET_asprintf (&host_str, "http://localhost:%u/",port);
+  GNUNET_log (GNUNET_ERROR_TYPE_INFO, _("Connecting to peer %s without any 
peer identification.\n"), host_str);
+  res = send_data (msg, &testtransfer_no_ident, host_str);
+  GNUNET_free (host_str);
 
+
   /* Add more tests */
 
   /* testing finished */
+
+
+
   return;
 }
 




reply via email to

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