gnunet-svn
[Top][All Lists]
Advanced

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

[GNUnet-SVN] r3668 - GNUnet/src/applications/bootstrap_http


From: grothoff
Subject: [GNUnet-SVN] r3668 - GNUnet/src/applications/bootstrap_http
Date: Tue, 7 Nov 2006 21:58:25 -0800 (PST)

Author: grothoff
Date: 2006-11-07 21:58:20 -0800 (Tue, 07 Nov 2006)
New Revision: 3668

Modified:
   GNUnet/src/applications/bootstrap_http/Makefile.am
   GNUnet/src/applications/bootstrap_http/http.c
   GNUnet/src/applications/bootstrap_http/httptest.c
Log:
found workaround for really weird curl crash

Modified: GNUnet/src/applications/bootstrap_http/Makefile.am
===================================================================
--- GNUnet/src/applications/bootstrap_http/Makefile.am  2006-11-08 04:58:45 UTC 
(rev 3667)
+++ GNUnet/src/applications/bootstrap_http/Makefile.am  2006-11-08 05:58:20 UTC 
(rev 3668)
@@ -22,9 +22,8 @@
 TESTS = $(check_PROGRAMS)
 
 httptest_SOURCES = \
-  httptest.c http.c
-httptest_LDADD = @LIBCURL@ \
+  httptest.c 
+httptest_LDADD = \
   $(top_builddir)/src/util/config_impl/libgnunetutil_config.la \
-  $(top_builddir)/src/util/crypto/libgnunetutil_crypto.la \
   $(top_builddir)/src/util/libgnunetutil.la 
 

Modified: GNUnet/src/applications/bootstrap_http/http.c
===================================================================
--- GNUnet/src/applications/bootstrap_http/http.c       2006-11-08 04:58:45 UTC 
(rev 3667)
+++ GNUnet/src/applications/bootstrap_http/http.c       2006-11-08 05:58:20 UTC 
(rev 3668)
@@ -239,9 +239,17 @@
     CURL_EASY_SETOPT(curl,
                     CURLOPT_USERAGENT,
                     "GNUnet");
+#if 1
   CURL_EASY_SETOPT(curl,
                   CURLOPT_CONNECTTIMEOUT,
                   15L);
+  /* NOTE: use of CONNECTTIMEOUT without also
+     setting NOSIGNAL results in really weird 
+     crashes on my system! */
+  CURL_EASY_SETOPT(curl,
+                  CURLOPT_NOSIGNAL,
+                  1);
+#endif 
 #if USE_MULTI
   multi = curl_multi_init();
   if (multi == NULL) {

Modified: GNUnet/src/applications/bootstrap_http/httptest.c
===================================================================
--- GNUnet/src/applications/bootstrap_http/httptest.c   2006-11-08 04:58:45 UTC 
(rev 3667)
+++ GNUnet/src/applications/bootstrap_http/httptest.c   2006-11-08 05:58:20 UTC 
(rev 3668)
@@ -41,10 +41,12 @@
 
 static int rsx(void * s) { return OK; }
 
+static unsigned int count;
+
+
 static void hello(const P2P_hello_MESSAGE * m,
                  void * arg) {
-  int * cls = arg;
-  (*cls)++;
+  count++;
 }
 
 static int terminate(void * arg) {
@@ -53,12 +55,26 @@
   return YES; /* todo: add timeout? */
 }
 
+static void * pt(void * b) {
+  Bootstrap_ServiceAPI * boot = b;
+  
+  boot->bootstrap(&hello,
+                 NULL,
+                 &terminate,
+                 NULL);
+  return NULL;
+}
+
 int main(int argc,
         char ** argv) {
   static CoreAPIForApplication capi;
   struct GC_Configuration * cfg;
+  struct PluginHandle * plugin;
   Bootstrap_ServiceAPI * boot;
-  unsigned int count;
+  struct PTHREAD * p;
+  void * unused;
+  ServiceInitMethod init;
+  ServiceDoneMethod done;
 
   count = 0;
   cfg = GC_create_C_impl();
@@ -73,12 +89,22 @@
   capi.cfg = cfg;
   capi.requestService = &rs;
   capi.releaseService = &rsx;
-  boot = provide_module_bootstrap(&capi);
-  boot->bootstrap(&hello,
-                 &count,
-                 &terminate,
-                 NULL);
-  release_module_bootstrap();
+  plugin = os_plugin_load(NULL,
+                         "libgnunetmodule_",
+                         "bootstrap");
+  init = os_plugin_resolve_function(plugin,
+                                   "provide_module_",
+                                   YES);
+  boot = init(&capi);
+  p = PTHREAD_CREATE(&pt,
+                    boot,
+                    1024 * 64);
+  PTHREAD_JOIN(p, &unused);
+  done = os_plugin_resolve_function(plugin,
+                                   "release_module_",
+                                   YES);
+  done();
+  os_plugin_unload(plugin);
   GC_free(cfg);
   if (count == 0)
     return 1;





reply via email to

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