gnunet-svn
[Top][All Lists]
Advanced

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

[GNUnet-SVN] r470 - in GNUnet/src/applications/fs: ecrs lib module


From: grothoff
Subject: [GNUnet-SVN] r470 - in GNUnet/src/applications/fs: ecrs lib module
Date: Sun, 20 Mar 2005 16:04:53 -0800 (PST)

Author: grothoff
Date: 2005-03-20 16:04:51 -0800 (Sun, 20 Mar 2005)
New Revision: 470

Modified:
   GNUnet/src/applications/fs/ecrs/unindex.c
   GNUnet/src/applications/fs/lib/fslib.c
   GNUnet/src/applications/fs/module/fs.c
Log:
more for indexinfo, some cleanup

Modified: GNUnet/src/applications/fs/ecrs/unindex.c
===================================================================
--- GNUnet/src/applications/fs/ecrs/unindex.c   2005-03-20 23:57:12 UTC (rev 
469)
+++ GNUnet/src/applications/fs/ecrs/unindex.c   2005-03-21 00:04:51 UTC (rev 
470)
@@ -27,7 +27,7 @@
  *
  * TODO:
  * - code cleanup (share more with
- *   upload.c, move detect index/unindex to FS_lib)
+ *   upload.c)
  */
 
 #include "platform.h"
@@ -196,7 +196,6 @@
   cron_t start;
   cron_t now;
   int wasIndexed;
-  RequestTestindex rti;
 
   cronTime(&start);
   if (isDirectory(filename)) {
@@ -232,23 +231,9 @@
   treedepth = computeDepth(filesize);
 
   /* Test if file is indexed! */
-  rti.header.size
-    = htons(sizeof(RequestTestindex));
-  rti.header.type
-    = htons(AFS_CS_PROTO_TESTINDEX);
-  rti.fileId = fileId;
-  if (OK != writeToSocket(sock,
-                         &rti.header)) {
-    releaseClientSocket(sock);
-    BREAK();
-    return SYSERR;
-  }
-  if (OK != readTCPResult(sock,
-                         &wasIndexed)) {
-    releaseClientSocket(sock);
-    BREAK();
-    return SYSERR;
-  }
+  wasIndexed
+    = FS_testIndexed(sock,
+                    &fileId);
 
 #ifdef O_LARGEFILE
   fd = OPEN(filename, O_RDONLY | O_LARGEFILE);

Modified: GNUnet/src/applications/fs/lib/fslib.c
===================================================================
--- GNUnet/src/applications/fs/lib/fslib.c      2005-03-20 23:57:12 UTC (rev 
469)
+++ GNUnet/src/applications/fs/lib/fslib.c      2005-03-21 00:04:51 UTC (rev 
470)
@@ -439,8 +439,19 @@
  */
 int FS_testIndexed(GNUNET_TCP_SOCKET * sock,
                   const HashCode512 * hc) {
-  // FIXME: implement!
-  return SYSERR;
+  RequestInitIndex ri;
+  int ret;
+
+  ri.header.size = htons(sizeof(RequestInitIndex));
+  ri.header.type = htons(AFS_CS_PROTO_TESTINDEX);
+  ri.fileId = *hc;
+  if (OK != writeToSocket(sock,
+                         &ri.header))
+    return SYSERR;
+  if (OK != readTCPResult(sock,
+                         &ret))
+    return SYSERR;
+  return ret;
 }
 
 

Modified: GNUnet/src/applications/fs/module/fs.c
===================================================================
--- GNUnet/src/applications/fs/module/fs.c      2005-03-20 23:57:12 UTC (rev 
469)
+++ GNUnet/src/applications/fs/module/fs.c      2005-03-21 00:04:51 UTC (rev 
470)
@@ -545,7 +545,6 @@
                                    ret);
 }
 
-
 /**
  * Process a client request to test if certain
  * data is indexed.





reply via email to

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