(no commit message)
authorMatthias Wachs <wachs@net.in.tum.de>
Mon, 3 May 2010 15:18:51 +0000 (15:18 +0000)
committerMatthias Wachs <wachs@net.in.tum.de>
Mon, 3 May 2010 15:18:51 +0000 (15:18 +0000)
src/transport/Makefile.am
src/transport/plugin_transport_http.c
src/transport/test_plugin_transport_data_http.conf

index c6f2bc2ff6009c1d4f9e7b7d3c0ab491e0b9bd45..a7dd645eedcfdb34f974210de284a56a617fd276 100644 (file)
@@ -123,6 +123,7 @@ libgnunet_plugin_transport_http_la_LIBADD = \
   $(top_builddir)/src/hello/libgnunethello.la \
   $(top_builddir)/src/statistics/libgnunetstatistics.la \
   $(top_builddir)/src/peerinfo/libgnunetpeerinfo.la \
+  @LIBCURL@ \
   $(top_builddir)/src/util/libgnunetutil.la 
 libgnunet_plugin_transport_http_la_LDFLAGS = \
  $(GN_LIBMHD) \
index 7ede6da3ceadb181a0de3f61ea9fb7483e5e1554..52a6ff0dc24f11a029d67722ee94934a5719cd4e 100644 (file)
@@ -33,6 +33,7 @@
 #include "gnunet_transport_service.h"
 #include "plugin_transport.h"
 #include "microhttpd.h"
+#include <curl/curl.h>
 
 #define VERBOSE GNUNET_YES
 #define DEBUG GNUNET_YES
@@ -137,6 +138,11 @@ struct Plugin
  */
 static struct MHD_Daemon *http_daemon;
 
+/**
+ * Curl multi for managing client operations.
+ */
+static CURLM *curl_multi;
+
 /**
  * Function that can be used by the transport service to transmit
  * a message using the plugin.
@@ -377,11 +383,14 @@ libgnunet_plugin_transport_http_init (void *cls)
                                          MHD_OPTION_END);
         }
     }
-  if ( NULL != http_daemon )
+
+  curl_multi = curl_multi_init ();
+
+  if ( (NULL != http_daemon) && (NULL != curl_multi))
     return api;
   else
   {
-    GNUNET_log (GNUNET_ERROR_TYPE_ERROR,"Starting MHD on port %u with IPv6 disabled\n",port);
+    GNUNET_log (GNUNET_ERROR_TYPE_ERROR,"Initializing http plugin failed\n");
     return NULL;
   }
 }
@@ -401,6 +410,10 @@ libgnunet_plugin_transport_http_done (void *cls)
     MHD_stop_daemon (http_daemon);
     http_daemon = NULL;
   }
+
+  curl_multi_cleanup (curl_multi);
+  curl_multi = NULL;
+
   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,"Shutting down http plugin...\n");
 
   GNUNET_free (plugin);
index 77f4bdbbb76bbbed2a23bbe770cdbea3e3ef4911..c4139380c147b0fbebfb9da80d4694638c48c0ca 100644 (file)
@@ -5,4 +5,4 @@ SERVICEHOME = /tmp/test-gnunetd-transport-peer-1/
 [transport-http]
 PORT = 12389
 DEBUG = YES
-USE_IPV6 = NO
\ No newline at end of file
+USE_IPV6 = YES
\ No newline at end of file