gnunet-svn
[Top][All Lists]
Advanced

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

[GNUnet-SVN] r11239 - in gnunet: . src/fs


From: gnunet
Subject: [GNUnet-SVN] r11239 - in gnunet: . src/fs
Date: Thu, 6 May 2010 22:28:21 +0200

Author: grothoff
Date: 2010-05-06 22:28:21 +0200 (Thu, 06 May 2010)
New Revision: 11239

Modified:
   gnunet/TODO
   gnunet/src/fs/Makefile.am
   gnunet/src/fs/fs.c
   gnunet/src/fs/fs.h
   gnunet/src/fs/fs_unindex.c
   gnunet/src/fs/test_fs_unindex_persistence.c
Log:
fix unindex persistence

Modified: gnunet/TODO
===================================================================
--- gnunet/TODO 2010-05-06 19:59:59 UTC (rev 11238)
+++ gnunet/TODO 2010-05-06 20:28:21 UTC (rev 11239)
@@ -1,8 +1,14 @@
 0.9.0pre1:
+* MIGRATION [CG]
+  - on-demand encoding => move logic to block-library!?
+  - peer selection => how to consider latency/bw/etc?
+  - content transmission => how often the same block?
+  - how to select delay before next migration? 
+  - migration to us
+  - testing
+  - integrate with FS or not? (peer list, index/on-demand encoding, block code,
+    inbound priority assignment; all would be easier with tight integration!)
 * FS: [CG]
-  - persistence testing (unindex, search):
-    * unindex:
-      + need to clean up state on stop/suspend (including file-hashing => util 
API change!) 
   - gnunet-service-fs (hot-path routing, load-based routing, nitpicks)  
   - [gnunet-service-fs.c:208]: member 'LocalGetContext::results_bf_size' is 
never used
   - [gnunet-service-fs.c:501]: member 'PendingRequest::used_pids_size' is 
never used
@@ -14,15 +20,6 @@
   - [gnunet-service-fs.c:700]: member 
'ConnectedPeer::last_client_replies_woff' is never used
   - GAP improvements:
     + active reply route caching design & implementation of service; gap 
extension!
-* MIGRATION [CG]
-  - on-demand encoding => move logic to block-library!?
-  - peer selection => how to consider latency/bw/etc?
-  - content transmission => how often the same block?
-  - how to select delay before next migration? 
-  - migration to us
-  - testing
-  - integrate with FS or not? (peer list, index/on-demand encoding, block code,
-    inbound priority assignment; all would be easier with tight integration!)
 * TBENCH: [MW]
   - good to have for transport/DV evaluation! 
 * DV: [Nate]

Modified: gnunet/src/fs/Makefile.am
===================================================================
--- gnunet/src/fs/Makefile.am   2010-05-06 19:59:59 UTC (rev 11238)
+++ gnunet/src/fs/Makefile.am   2010-05-06 20:28:21 UTC (rev 11239)
@@ -157,6 +157,7 @@
  test_fs_search_persistence \
  test_fs_start_stop \
  test_fs_unindex \
+ test_fs_unindex_persistence \
  test_fs_uri \
  test_fs_test_lib \
  test_gnunet_service_fs_p2p

Modified: gnunet/src/fs/fs.c
===================================================================
--- gnunet/src/fs/fs.c  2010-05-06 19:59:59 UTC (rev 11238)
+++ gnunet/src/fs/fs.c  2010-05-06 20:28:21 UTC (rev 11239)
@@ -1571,8 +1571,6 @@
 {
   struct GNUNET_BIO_WriteHandle *wh;
 
-  if (UNINDEX_STATE_ABORTED == uc->state)
-    return;
   if (NULL == uc->serialization)
     uc->serialization = make_serialization_file_name (uc->h,
                                                      
GNUNET_FS_SYNC_PATH_MASTER_UNINDEX);
@@ -2038,9 +2036,6 @@
          goto cleanup;
        }
       break;
-    case UNINDEX_STATE_ABORTED:
-      GNUNET_break (0);
-      goto cleanup;
     default:
       GNUNET_break (0);
       goto cleanup;

Modified: gnunet/src/fs/fs.h
===================================================================
--- gnunet/src/fs/fs.h  2010-05-06 19:59:59 UTC (rev 11238)
+++ gnunet/src/fs/fs.h  2010-05-06 20:28:21 UTC (rev 11239)
@@ -1339,13 +1339,8 @@
     /**
      * We've encountered a fatal error.
      */
-    UNINDEX_STATE_ERROR = 4,
+    UNINDEX_STATE_ERROR = 4
 
-    /**
-     * We've been aborted.  The next callback should clean up the
-     * struct.
-     */
-    UNINDEX_STATE_ABORTED = 5
   };
 
 

Modified: gnunet/src/fs/fs_unindex.c
===================================================================
--- gnunet/src/fs/fs_unindex.c  2010-05-06 19:59:59 UTC (rev 11238)
+++ gnunet/src/fs/fs_unindex.c  2010-05-06 20:28:21 UTC (rev 11239)
@@ -243,6 +243,7 @@
   GNUNET_FS_tree_encoder_finish (uc->tc,
                                 &uri,
                                 &emsg);
+  uc->tc = NULL;
   if (uri != NULL)
     GNUNET_FS_uri_destroy (uri);
   GNUNET_DISK_file_close (uc->fh);
@@ -251,11 +252,13 @@
   uc->dsh = NULL;
   if (emsg != NULL)
     {
+      uc->state = UNINDEX_STATE_ERROR;
       uc->emsg = emsg;
       signal_unindex_error (uc);
     }
-  else
+  else 
     {   
+      uc->state = UNINDEX_STATE_COMPLETE;
       pi.status = GNUNET_FS_STATUS_UNINDEX_COMPLETED;
       pi.value.unindex.eta = GNUNET_TIME_UNIT_ZERO;
       GNUNET_FS_unindex_make_status_ (&pi, uc, uc->file_size);
@@ -284,7 +287,10 @@
     }
   if (uc->state != UNINDEX_STATE_FS_NOTIFY) 
     {
-      GNUNET_FS_unindex_stop (uc);
+      uc->state = UNINDEX_STATE_ERROR;
+      uc->emsg = GNUNET_strdup (_("Unexpected time for a response from `fs' 
service."));
+      GNUNET_FS_unindex_sync_ (uc);
+      signal_unindex_error (uc);                           
       return;
     }
   if (NULL == msg)
@@ -416,6 +422,28 @@
       GNUNET_CRYPTO_hash_file_cancel (uc->fhc);
       uc->fhc = NULL;
     }
+  if (uc->client != NULL)
+    {
+      GNUNET_CLIENT_disconnect (uc->client, GNUNET_NO);
+      uc->client = NULL;
+    }
+  if (NULL != uc->dsh)
+    {
+      GNUNET_DATASTORE_disconnect (uc->dsh, GNUNET_NO);
+      uc->dsh = NULL;
+    }
+  if (NULL != uc->tc)
+    {
+      GNUNET_FS_tree_encoder_finish (uc->tc,
+                                    NULL, 
+                                    NULL);
+      uc->tc = NULL;
+    }
+  if (uc->fh != NULL)
+    {
+      GNUNET_DISK_file_close (uc->fh);
+      uc->fh = NULL;
+    }
   GNUNET_FS_end_top (uc->h, uc->top);
   pi.status = GNUNET_FS_STATUS_UNINDEX_SUSPEND;
   GNUNET_FS_unindex_make_status_ (&pi, uc, 
@@ -488,17 +516,29 @@
       GNUNET_CRYPTO_hash_file_cancel (uc->fhc);
       uc->fhc = NULL;
     }
-  /* FIXME: disconnect uc->client (if still connected) */
-  /* FIXME: disconnect from datastore (if still connected) */
-  /* FIXME: other termination operations? */
-  /* FIXME: must do same cleanup in 'unindex_signal_suspend'! */
-  GNUNET_FS_end_top (uc->h, uc->top);
-  if ( (uc->state != UNINDEX_STATE_COMPLETE) &&
-       (uc->state != UNINDEX_STATE_ERROR) )
+  if (uc->client != NULL)
     {
-      uc->state = UNINDEX_STATE_ABORTED;
-      return;
+      GNUNET_CLIENT_disconnect (uc->client, GNUNET_NO);
+      uc->client = NULL;
     }
+  if (NULL != uc->dsh)
+    {
+      GNUNET_DATASTORE_disconnect (uc->dsh, GNUNET_NO);
+      uc->dsh = NULL;
+    }
+  if (NULL != uc->tc)
+    {
+      GNUNET_FS_tree_encoder_finish (uc->tc,
+                                    NULL, 
+                                    NULL);
+      uc->tc = NULL;
+    }
+  if (uc->fh != NULL)
+    {
+      GNUNET_DISK_file_close (uc->fh);
+      uc->fh = NULL;
+    }
+  GNUNET_FS_end_top (uc->h, uc->top);
   if (uc->serialization != NULL)
     {
       GNUNET_FS_remove_sync_file_ (uc->h, GNUNET_FS_SYNC_PATH_MASTER_UNINDEX, 
uc->serialization);

Modified: gnunet/src/fs/test_fs_unindex_persistence.c
===================================================================
--- gnunet/src/fs/test_fs_unindex_persistence.c 2010-05-06 19:59:59 UTC (rev 
11238)
+++ gnunet/src/fs/test_fs_unindex_persistence.c 2010-05-06 20:28:21 UTC (rev 
11239)
@@ -161,7 +161,6 @@
       GNUNET_assert (unindex != NULL);
       break;
     case GNUNET_FS_STATUS_UNINDEX_COMPLETED:
-      consider_restart (event->status);
       printf ("Unindex complete,  %llu kbps.\n",
              (unsigned long long) (FILESIZE * 1000 / 
(1+GNUNET_TIME_absolute_get_duration (start).value) / 1024));
       GNUNET_SCHEDULER_add_continuation (sched,
@@ -180,6 +179,25 @@
              (unsigned long long) 
event->value.unindex.specifics.progress.offset);
 #endif
       break;
+    case GNUNET_FS_STATUS_PUBLISH_SUSPEND:
+      if  (event->value.publish.sc == publish)
+       publish = NULL;
+      break;
+    case GNUNET_FS_STATUS_PUBLISH_RESUME:
+      if (NULL == publish)
+       {
+         publish = event->value.publish.sc;
+         return "publish-context";
+       }
+      break;
+    case GNUNET_FS_STATUS_UNINDEX_SUSPEND:
+      GNUNET_assert (event->value.unindex.uc == unindex);
+      unindex = NULL;
+      break;
+    case GNUNET_FS_STATUS_UNINDEX_RESUME:
+      GNUNET_assert (NULL == unindex);
+      unindex = event->value.unindex.uc;
+      return "unindex";
     case GNUNET_FS_STATUS_PUBLISH_ERROR:
       fprintf (stderr,
               "Error publishing file: %s\n",
@@ -222,7 +240,6 @@
       GNUNET_assert (0 == event->value.unindex.completed);
       break;
     case GNUNET_FS_STATUS_UNINDEX_STOPPED:
-      consider_restart (event->status);
       GNUNET_assert (unindex == event->value.unindex.uc);
       GNUNET_SCHEDULER_add_continuation (sched,
                                         &abort_publish_task,





reply via email to

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