gnunet-svn
[Top][All Lists]
Advanced

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

[GNUnet-SVN] r9741 - in GNUnet/src/applications: datastore fs/gap


From: gnunet
Subject: [GNUnet-SVN] r9741 - in GNUnet/src/applications: datastore fs/gap
Date: Sat, 12 Dec 2009 17:40:38 +0100

Author: grothoff
Date: 2009-12-12 17:40:38 +0100 (Sat, 12 Dec 2009)
New Revision: 9741

Modified:
   GNUnet/src/applications/datastore/datastore.c
   GNUnet/src/applications/fs/gap/ondemand.c
Log:
go a bit lighter on logging

Modified: GNUnet/src/applications/datastore/datastore.c
===================================================================
--- GNUnet/src/applications/datastore/datastore.c       2009-12-12 16:40:18 UTC 
(rev 9740)
+++ GNUnet/src/applications/datastore/datastore.c       2009-12-12 16:40:38 UTC 
(rev 9741)
@@ -188,7 +188,10 @@
                ntohl (value->size) - sizeof (GNUNET_DatastoreValue), &vhc);
   ok = sq->get (query, &vhc, ntohl (value->type), &deleteCB, (void *) value);
   if (ok == GNUNET_SYSERR)
-    return GNUNET_SYSERR;
+    {
+      GNUNET_GE_BREAK (NULL, 0);
+      return GNUNET_SYSERR;
+    }
   if (ok == 0)
     {
       IF_GELOG (coreAPI->ectx,

Modified: GNUnet/src/applications/fs/gap/ondemand.c
===================================================================
--- GNUnet/src/applications/fs/gap/ondemand.c   2009-12-12 16:40:18 UTC (rev 
9740)
+++ GNUnet/src/applications/fs/gap/ondemand.c   2009-12-12 16:40:38 UTC (rev 
9741)
@@ -124,8 +124,10 @@
  * called to either initially mark a file as unavailable,
  * or, if the condition persists, to trigger its
  * removal from the database.
+ *
+ * @return GNUNET_YES if this is a new mark
  */
-static void
+static int
 publish_unavailable_mark (const GNUNET_HashCode * fileId)
 {
   char unavail_key[256];
@@ -145,11 +147,11 @@
     {
       now = GNUNET_htonll (now);
       state->write (coreAPI->ectx,
-                    unavail_key, sizeof (GNUNET_CronTime), (void *) &now);
-      return;
+                    unavail_key, sizeof (GNUNET_CronTime), (void *) &now);     
 
+      return GNUNET_YES;
     }
   if (GNUNET_ntohll (*first_unavail) - now < 3 * GNUNET_CRON_DAYS)
-    return;                     /* do nothing for first 3 days */
+    return GNUNET_NO;                     /* do nothing for first 3 days */
   fn = get_indexed_filename (fileId);
   /* Delete it after 3 days */
   len = 256;
@@ -161,7 +163,7 @@
         GNUNET_GE_BREAK (coreAPI->ectx, 0);
         GNUNET_array_grow (ofn, len, 0);
         GNUNET_free (fn);
-        return;
+        return GNUNET_NO;
       }
   GNUNET_array_grow (ofn, len, len * 2);
   if (ret != -1)
@@ -179,6 +181,7 @@
   state->unlink (coreAPI->ectx, unavail_key);
   UNLINK (fn);
   GNUNET_free (fn);
+  return GNUNET_NO;
 }
 
 /**
@@ -379,8 +382,8 @@
   const OnDemandBlock *odb;
   GNUNET_EC_DBlock *db;
   struct stat linkStat;
+  int eno;
 
-
   if ((ntohl (dbv->size) != sizeof (OnDemandBlock)) ||
       (ntohl (dbv->type) != GNUNET_ECRS_BLOCKTYPE_ONDEMAND))
     {
@@ -395,15 +398,28 @@
                                                   fn, O_LARGEFILE | O_RDONLY,
                                                   0))))
     {
-      GNUNET_GE_LOG_STRERROR_FILE (coreAPI->ectx,
-                                   GNUNET_GE_WARNING | GNUNET_GE_ADMIN |
-                                   GNUNET_GE_USER | GNUNET_GE_BULK, "open",
-                                   fn);
+      eno = errno;
       /* Is the symlink (still) there? */
       if (LSTAT (fn, &linkStat) == -1)
-        delete_content_asynchronously (dbv, query);
+       {
+         errno = eno;
+         GNUNET_GE_LOG_STRERROR_FILE (coreAPI->ectx,
+                                      GNUNET_GE_WARNING | GNUNET_GE_ADMIN |
+                                      GNUNET_GE_USER | GNUNET_GE_BULK, "open",
+                                      fn);
+         delete_content_asynchronously (dbv, query);
+       }
       else
-        publish_unavailable_mark (&odb->fileId);
+       {
+         if (GNUNET_YES == publish_unavailable_mark (&odb->fileId))
+           {
+             errno = eno;
+             GNUNET_GE_LOG_STRERROR_FILE (coreAPI->ectx,
+                                          GNUNET_GE_WARNING | GNUNET_GE_ADMIN |
+                                          GNUNET_GE_USER | GNUNET_GE_BULK, 
"open",
+                                          fn);
+           }
+       }
       GNUNET_free (fn);
       return GNUNET_SYSERR;
     }





reply via email to

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