gnunet-svn
[Top][All Lists]
Advanced

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

[GNUnet-SVN] r11373 - gnunet/src/fs


From: gnunet
Subject: [GNUnet-SVN] r11373 - gnunet/src/fs
Date: Fri, 14 May 2010 17:35:57 +0200

Author: grothoff
Date: 2010-05-14 17:35:57 +0200 (Fri, 14 May 2010)
New Revision: 11373

Modified:
   gnunet/src/fs/fs_publish.c
   gnunet/src/fs/fs_test_lib_data.conf
   gnunet/src/fs/gnunet-service-fs.c
   gnunet/src/fs/test_fs_download.c
   gnunet/src/fs/test_gnunet_service_fs_p2p.c
Log:
fixes

Modified: gnunet/src/fs/fs_publish.c
===================================================================
--- gnunet/src/fs/fs_publish.c  2010-05-14 15:11:39 UTC (rev 11372)
+++ gnunet/src/fs/fs_publish.c  2010-05-14 15:35:57 UTC (rev 11373)
@@ -117,6 +117,7 @@
                 const struct GNUNET_SCHEDULER_TaskContext *tc)
 {
   struct GNUNET_FS_PublishContext *pc = cls;
+
   GNUNET_FS_file_information_destroy (pc->fi, NULL, NULL);
   if (pc->namespace != NULL)
     GNUNET_FS_namespace_delete (pc->namespace, GNUNET_NO);
@@ -124,7 +125,10 @@
   GNUNET_free_non_null (pc->nuid);
   GNUNET_free_non_null (pc->serialization);
   if (pc->dsh != NULL)
-    GNUNET_DATASTORE_disconnect (pc->dsh, GNUNET_NO);
+    {
+      GNUNET_DATASTORE_disconnect (pc->dsh, GNUNET_NO);
+      pc->dsh = NULL;
+    }
   if (pc->client != NULL)
     GNUNET_CLIENT_disconnect (pc->client, GNUNET_NO);
   GNUNET_free (pc);
@@ -997,6 +1001,11 @@
   pi.status = GNUNET_FS_STATUS_PUBLISH_SUSPEND;
   GNUNET_break (NULL == GNUNET_FS_publish_make_status_ (&pi, sc, fi, off));
   *client_info = NULL;
+  if (NULL != sc->dsh)
+    {
+      GNUNET_DATASTORE_disconnect (sc->dsh, GNUNET_NO);
+      sc->dsh = NULL;
+    }
   return GNUNET_OK;
 }
 
@@ -1021,12 +1030,10 @@
                                      &fip_signal_suspend,
                                      pc);
   GNUNET_FS_end_top (pc->h, pc->top);
-  GNUNET_SCHEDULER_add_continuation (pc->h->sched,                             
         
-                                    &publish_cleanup,
-                                    pc,
-                                    GNUNET_SCHEDULER_REASON_PREREQ_DONE);
+  publish_cleanup (pc, NULL);
 }
 
+
 /**
  * Publish a file or directory.
  *
@@ -1152,6 +1159,11 @@
 GNUNET_FS_publish_stop (struct GNUNET_FS_PublishContext *pc)
 {
   GNUNET_FS_end_top (pc->h, pc->top);
+  if (NULL != pc->dsh)
+    {
+      GNUNET_DATASTORE_disconnect (pc->dsh, GNUNET_NO);
+      pc->dsh = NULL;
+    }
   if (GNUNET_SCHEDULER_NO_TASK != pc->upload_task)
     {
       GNUNET_SCHEDULER_cancel (pc->h->sched, pc->upload_task);
@@ -1171,10 +1183,7 @@
       pc->in_network_wait = GNUNET_SYSERR;
       return;
     }
-  GNUNET_SCHEDULER_add_continuation (pc->h->sched,                             
         
-                                    &publish_cleanup,
-                                    pc,
-                                    GNUNET_SCHEDULER_REASON_PREREQ_DONE);
+  publish_cleanup (pc, NULL);
 }
 
 
@@ -1285,7 +1294,11 @@
 
   if (GNUNET_OK != success)
     {
-      GNUNET_DATASTORE_disconnect (pkc->dsh, GNUNET_NO);
+      if (NULL != pkc->dsh)
+       {
+         GNUNET_DATASTORE_disconnect (pkc->dsh, GNUNET_NO);
+         pkc->dsh = NULL;
+       }
       GNUNET_free (pkc->cpy);
       GNUNET_free (pkc->kb);
       pkc->cont (pkc->cont_cls,
@@ -1326,7 +1339,10 @@
        (NULL == pkc->dsh) )
     {
       if (NULL != pkc->dsh)
-       GNUNET_DATASTORE_disconnect (pkc->dsh, GNUNET_NO);
+       {
+         GNUNET_DATASTORE_disconnect (pkc->dsh, GNUNET_NO);
+         pkc->dsh = NULL;
+       }
       GNUNET_free (pkc->cpy);
       GNUNET_free (pkc->kb);
       pkc->cont (pkc->cont_cls,
@@ -1452,7 +1468,10 @@
       GNUNET_break (0);
       GNUNET_free (pkc->kb);
       if (pkc->dsh != NULL)
-       GNUNET_DATASTORE_disconnect (pkc->dsh, GNUNET_NO);
+       {
+         GNUNET_DATASTORE_disconnect (pkc->dsh, GNUNET_NO);
+         pkc->dsh = NULL;
+       }
       cont (cont_cls, NULL, _("Internal error."));
       GNUNET_free (pkc);
       return;
@@ -1518,7 +1537,10 @@
   struct PublishSksContext *psc = cls;
 
   if (NULL != psc->dsh)
-    GNUNET_DATASTORE_disconnect (psc->dsh, GNUNET_NO);
+    {
+      GNUNET_DATASTORE_disconnect (psc->dsh, GNUNET_NO);
+      psc->dsh = NULL;
+    }
   if (GNUNET_OK != success)
     psc->cont (psc->cont_cls,
               NULL,
@@ -1685,7 +1707,6 @@
                        GNUNET_CONSTANTS_SERVICE_TIMEOUT,
                        &sb_put_cont,
                        psc);
-
   GNUNET_free (sb);
   GNUNET_free (sb_enc);
 }

Modified: gnunet/src/fs/fs_test_lib_data.conf
===================================================================
--- gnunet/src/fs/fs_test_lib_data.conf 2010-05-14 15:11:39 UTC (rev 11372)
+++ gnunet/src/fs/fs_test_lib_data.conf 2010-05-14 15:35:57 UTC (rev 11373)
@@ -20,7 +20,7 @@
 DEFAULTSERVICES = 
 
 [datastore]
-#DEBUG = YES
+DEBUG = YES
 #PREFIX = valgrind --tool=memcheck --leak-check=yes
 #BINARY = /home/grothoff/bin/gnunet-service-datastore
 
@@ -52,7 +52,7 @@
 PORT = 43471
 HOSTNAME = localhost
 #OPTIONS = -L DEBUG
-# DEBUG = YES
+DEBUG = YES
 #PREFIX = valgrind --tool=memcheck --leak-check=yes
 #BINARY = /home/grothoff/bin/gnunet-service-fs
 #PREFIX = xterm -e gdb -x cmd --args 

Modified: gnunet/src/fs/gnunet-service-fs.c
===================================================================
--- gnunet/src/fs/gnunet-service-fs.c   2010-05-14 15:11:39 UTC (rev 11372)
+++ gnunet/src/fs/gnunet-service-fs.c   2010-05-14 15:35:57 UTC (rev 11373)
@@ -2270,6 +2270,7 @@
                                            anonymity, expiration, uid, 
                                            &process_local_reply,
                                            pr))
+      if (pr->qe != NULL)
        GNUNET_DATASTORE_get_next (dsh, GNUNET_YES);
       return;
     }
@@ -2291,7 +2292,8 @@
                                gettext_noop ("# results filtered by query 
bloomfilter"),
                                1,
                                GNUNET_NO);
-      GNUNET_DATASTORE_get_next (dsh, GNUNET_YES);
+      if (pr->qe != NULL)
+       GNUNET_DATASTORE_get_next (dsh, GNUNET_YES);
       return;
     }
 #if DEBUG_FS
@@ -2332,7 +2334,8 @@
   if ( (type == GNUNET_BLOCK_TYPE_DBLOCK) ||
        (type == GNUNET_BLOCK_TYPE_IBLOCK) ) 
     {
-      GNUNET_DATASTORE_get_next (dsh, GNUNET_NO);
+      if (pr->qe != NULL)
+       GNUNET_DATASTORE_get_next (dsh, GNUNET_NO);
       return;
     }
   if ( (pr->client_request_list == NULL) &&
@@ -2347,10 +2350,12 @@
                                gettext_noop ("# processing result set cut 
short due to load"),
                                1,
                                GNUNET_NO);
-      GNUNET_DATASTORE_get_next (dsh, GNUNET_NO);
+      if (pr->qe != NULL)
+       GNUNET_DATASTORE_get_next (dsh, GNUNET_NO);
       return;
     }
-  GNUNET_DATASTORE_get_next (dsh, GNUNET_YES);
+  if (pr->qe != NULL)
+    GNUNET_DATASTORE_get_next (dsh, GNUNET_YES);
 }
 
 

Modified: gnunet/src/fs/test_fs_download.c
===================================================================
--- gnunet/src/fs/test_fs_download.c    2010-05-14 15:11:39 UTC (rev 11372)
+++ gnunet/src/fs/test_fs_download.c    2010-05-14 15:35:57 UTC (rev 11373)
@@ -103,6 +103,13 @@
     }
 }
 
+static void
+stop_fs_task (void *cls,
+             const struct GNUNET_SCHEDULER_TaskContext *tc)
+{
+  GNUNET_FS_stop (fs);
+  fs = NULL;
+}
 
 static void
 abort_download_task (void *cls,
@@ -207,8 +214,9 @@
       GNUNET_assert (publish == event->value.publish.sc);
       GNUNET_assert (FILESIZE == event->value.publish.size);
       GNUNET_assert (1 == event->value.publish.anonymity);
-      GNUNET_FS_stop (fs);
-      fs = NULL;
+      GNUNET_SCHEDULER_add_now (sched,
+                               &stop_fs_task,
+                               NULL);
       break;
     case GNUNET_FS_STATUS_DOWNLOAD_START:
       GNUNET_assert (download == NULL);

Modified: gnunet/src/fs/test_gnunet_service_fs_p2p.c
===================================================================
--- gnunet/src/fs/test_gnunet_service_fs_p2p.c  2010-05-14 15:11:39 UTC (rev 
11372)
+++ gnunet/src/fs/test_gnunet_service_fs_p2p.c  2010-05-14 15:35:57 UTC (rev 
11373)
@@ -26,7 +26,7 @@
 #include "platform.h"
 #include "fs_test_lib.h"
 
-#define VERBOSE GNUNET_NO
+#define VERBOSE GNUNET_YES
 
 /**
  * File-size we use for testing.




reply via email to

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