gnunet-svn
[Top][All Lists]
Advanced

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

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


From: gnunet
Subject: [GNUnet-SVN] r11197 - gnunet/src/fs
Date: Wed, 5 May 2010 15:39:20 +0200

Author: grothoff
Date: 2010-05-05 15:39:20 +0200 (Wed, 05 May 2010)
New Revision: 11197

Modified:
   gnunet/src/fs/fs.c
   gnunet/src/fs/fs_publish.c
   gnunet/src/fs/fs_unindex.c
Log:
bugs

Modified: gnunet/src/fs/fs.c
===================================================================
--- gnunet/src/fs/fs.c  2010-05-05 13:15:06 UTC (rev 11196)
+++ gnunet/src/fs/fs.c  2010-05-05 13:39:20 UTC (rev 11197)
@@ -424,7 +424,7 @@
                                               &basename))
     return NULL;
   GNUNET_asprintf (&ret,
-                  "%s%s%s%s%s%s",
+                  "%s%s%s%s%s%s%s",
                   basename,
                   DIR_SEPARATOR_STR,
                   h->client_name,
@@ -466,7 +466,7 @@
                                               &basename))
     return NULL;
   GNUNET_asprintf (&ret,
-                  "%s%s%s%s%s%s%s%s",
+                  "%s%s%s%s%s%s%s%s%s",
                   basename,
                   DIR_SEPARATOR_STR,
                   h->client_name,
@@ -524,8 +524,14 @@
 
   fn = get_serialization_file_name (h, ext, ent);
   if (fn == NULL)
-    return NULL;
+    {
+      return NULL;
+    }
   ret = GNUNET_BIO_write_open (fn);
+  if (ret == NULL)
+    fprintf (stderr,
+            "Failed to create write handle for `%s' from `%s/%s'\n",
+            fn, ext, ent);
   GNUNET_free (fn);
   return ret;
 }
@@ -950,7 +956,7 @@
   nxt = fullname;
   /* FIXME: we could do this faster since we know
      the length of 'end'... */
-  while ('\0' != nxt)
+  while ('\0' != *nxt)
     {
       if (DIR_SEPARATOR == *nxt)
        end = nxt + 1;
@@ -1190,7 +1196,7 @@
       goto cleanup;
     }
   if (GNUNET_OK !=
-      GNUNET_BIO_write_string (wh, fi->next->serialization))
+      GNUNET_BIO_write_string (wh, (fi->next != NULL) ? 
fi->next->serialization : NULL))
     goto cleanup;  
   if (GNUNET_OK ==
       GNUNET_BIO_write_close (wh))
@@ -1429,6 +1435,8 @@
       return;
     }
   wh = get_write_handle (pc->h, GNUNET_FS_SYNC_PATH_MASTER_PUBLISH, 
pc->serialization);
+  if (wh == NULL)
+    goto cleanup;
   if ( (GNUNET_OK !=
        GNUNET_BIO_write_string (wh, pc->nid)) ||
        (GNUNET_OK !=
@@ -1483,6 +1491,8 @@
   if (NULL == uc->serialization)
     return;
   wh = get_write_handle (uc->h, GNUNET_FS_SYNC_PATH_MASTER_UNINDEX, 
uc->serialization);
+  if (wh == NULL)
+    goto cleanup;
   if ( (GNUNET_OK !=
        GNUNET_BIO_write_string (wh, uc->filename)) ||
        (GNUNET_OK !=
@@ -1736,6 +1746,8 @@
                                : GNUNET_FS_SYNC_PATH_CHILD_SEARCH,
                                sr->sc->serialization,
                                sr->serialization);
+  if (wh == NULL)
+    goto cleanup;
   uris = GNUNET_FS_uri_to_string (sr->uri);
   if ( (GNUNET_OK !=
        GNUNET_BIO_write_string (wh, uris)) ||
@@ -1804,6 +1816,8 @@
   if (NULL == sc->serialization)
     return;
   wh = get_write_handle (sc->h, category, sc->serialization);
+  if (wh == NULL)
+    goto cleanup;
   GNUNET_assert ( (GNUNET_YES == GNUNET_FS_uri_test_ksk (sc->uri)) ||
                  (GNUNET_YES == GNUNET_FS_uri_test_sks (sc->uri)) );
   uris = GNUNET_FS_uri_to_string (sc->uri);

Modified: gnunet/src/fs/fs_publish.c
===================================================================
--- gnunet/src/fs/fs_publish.c  2010-05-05 13:15:06 UTC (rev 11196)
+++ gnunet/src/fs/fs_publish.c  2010-05-05 13:39:20 UTC (rev 11197)
@@ -557,6 +557,7 @@
   uint64_t size;
 
   p = sc->fi_pos;
+  GNUNET_assert (p != NULL);
   if (NULL == p->te)
     {
       if (p->is_directory)
@@ -1062,13 +1063,13 @@
       if (NULL != nuid)
        ret->nuid = GNUNET_strdup (nuid);
     }
-  GNUNET_FS_publish_sync_ (ret);
   /* signal start */
   GNUNET_FS_file_information_inspect (ret->fi,
                                      &fip_signal_start,
                                      ret);
   ret->fi_pos = ret->fi;
   ret->top = GNUNET_FS_make_top (h, &publish_signal_suspend, ret);
+  GNUNET_FS_publish_sync_ (ret);
   // FIXME: calculate space needed for "fi"
   // and reserve as first task (then trigger
   // "publish_main" from that continuation)!

Modified: gnunet/src/fs/fs_unindex.c
===================================================================
--- gnunet/src/fs/fs_unindex.c  2010-05-05 13:15:06 UTC (rev 11196)
+++ gnunet/src/fs/fs_unindex.c  2010-05-05 13:39:20 UTC (rev 11197)
@@ -454,6 +454,7 @@
   pi.status = GNUNET_FS_STATUS_UNINDEX_START;
   pi.value.unindex.eta = GNUNET_TIME_UNIT_FOREVER_REL;
   GNUNET_FS_unindex_make_status_ (&pi, ret, 0);
+  /* FIXME: must be able to abort hashing here! */
   GNUNET_CRYPTO_hash_file (h->sched,
                           GNUNET_SCHEDULER_PRIORITY_IDLE,
                           filename,
@@ -476,7 +477,12 @@
 GNUNET_FS_unindex_stop (struct GNUNET_FS_UnindexContext *uc)
 {  
   struct GNUNET_FS_ProgressInfo pi;
-
+  
+  /* FIXME: stop hashing (if still ongoing) */
+  /* 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) )





reply via email to

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