gnunet-svn
[Top][All Lists]
Advanced

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

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


From: grothoff
Subject: [GNUnet-SVN] r4003 - in GNUnet/src/applications/fs: ecrs fsui lib module
Date: Thu, 21 Dec 2006 18:01:04 -0800 (PST)

Author: grothoff
Date: 2006-12-21 18:00:59 -0800 (Thu, 21 Dec 2006)
New Revision: 4003

Modified:
   GNUnet/src/applications/fs/ecrs/download.c
   GNUnet/src/applications/fs/ecrs/upload.c
   GNUnet/src/applications/fs/fsui/serializetest2.c
   GNUnet/src/applications/fs/lib/fslib.c
   GNUnet/src/applications/fs/module/ondemand.c
Log:
fix

Modified: GNUnet/src/applications/fs/ecrs/download.c
===================================================================
--- GNUnet/src/applications/fs/ecrs/download.c  2006-12-22 01:29:46 UTC (rev 
4002)
+++ GNUnet/src/applications/fs/ecrs/download.c  2006-12-22 02:00:59 UTC (rev 
4003)
@@ -430,10 +430,13 @@
   RequestManager * rm;
 
   rm = MALLOC(sizeof(RequestManager));
+  rm->lock
+    = MUTEX_CREATE(YES);
   rm->sctx = FS_SEARCH_makeContext(ectx,
                                   cfg,
                                   rm->lock);
   if (rm->sctx == NULL) {
+    MUTEX_DESTROY(rm->lock);
     FREE(rm);
     return NULL;
   }
@@ -447,8 +450,6 @@
     = NO;
   rm->lastDET
     = 0;
-  rm->lock
-    = MUTEX_CREATE(YES);
   rm->requestListIndex
     = 0;
   rm->requestListSize
@@ -506,8 +507,9 @@
   GROW(rm->requestList,
        rm->requestListSize,
        0);
+  FS_SEARCH_destroyContext(rm->sctx);
+  rm->sctx = NULL;
   MUTEX_UNLOCK(rm->lock);
-  FS_SEARCH_destroyContext(rm->sctx);
   MUTEX_DESTROY(rm->lock);
   PTHREAD_REL_SELF(rm->requestThread);
   FREE(rm);
@@ -920,7 +922,8 @@
  */
 static int nodeReceive(const HashCode512 * query,
                       const Datastore_Value * reply,
-                      NodeClosure * node) {
+                      void * cls) {
+  NodeClosure * node = cls;
   struct GE_Context * ectx = node->ctx->rm->ectx;
   HashCode512 hc;
   unsigned int size;
@@ -1123,7 +1126,7 @@
                      entry->node->ctx->anonymityLevel,
                      priority,
                      timeout,
-                     (Datum_Iterator) &nodeReceive,
+                     &nodeReceive,
                      entry->node);
   if (entry->searchHandle != NULL) {
     entry->lastPriority = priority;

Modified: GNUnet/src/applications/fs/ecrs/upload.c
===================================================================
--- GNUnet/src/applications/fs/ecrs/upload.c    2006-12-22 01:29:46 UTC (rev 
4002)
+++ GNUnet/src/applications/fs/ecrs/upload.c    2006-12-22 02:00:59 UTC (rev 
4003)
@@ -219,6 +219,9 @@
             _("Indexing file `%s' failed. Trying to insert file...\n"),
             filename);
       doIndex = YES;
+      break;
+    default:
+      break;
     }
   }
   treedepth = computeDepth(filesize);

Modified: GNUnet/src/applications/fs/fsui/serializetest2.c
===================================================================
--- GNUnet/src/applications/fs/fsui/serializetest2.c    2006-12-22 01:29:46 UTC 
(rev 4002)
+++ GNUnet/src/applications/fs/fsui/serializetest2.c    2006-12-22 02:00:59 UTC 
(rev 4003)
@@ -205,12 +205,31 @@
 #endif
     break;
   case FSUI_unindex_error:
+    fprintf(stderr,
+           "Received ERROR: %d %s\n",
+           event->type,
+           event->data.UnindexError.message);
+    GE_BREAK(ectx, 0);
+    break;
   case FSUI_upload_error:
+    fprintf(stderr,
+           "Received ERROR: %d %s\n",
+           event->type,
+           event->data.UploadError.message);
+    GE_BREAK(ectx, 0);
+    break;
   case FSUI_download_error:
+    fprintf(stderr,
+           "Received ERROR: %d %s\n",
+           event->type,
+           event->data.DownloadError.message);
+    GE_BREAK(ectx, 0);
+    break;
   case FSUI_search_error:
     fprintf(stderr,
-           "Received ERROR: %d\n",
-           event->type);
+           "Received ERROR: %d %s\n",
+           event->type,
+           event->data.SearchError.message);
     GE_BREAK(ectx, 0);
     break;
   case FSUI_download_aborted:
@@ -375,6 +394,7 @@
   ECRS_freeUri(kuri);
   kuri = NULL;
   FSUI_stopUpload(ctx, upload);
+  CHECK(upURI != NULL);
   SNPRINTF(keyword,
           40,
           "%s %s %s",
@@ -462,7 +482,7 @@
     ECRS_freeUri(upURI);
 
 #if START_DAEMON
-  GE_ASSERT(NULL, OK == os_daemon_stop(NULL, daemon));
+  GE_BREAK(NULL, OK == os_daemon_stop(NULL, daemon));
 #endif
   GC_free(cfg);
   if (have_error)

Modified: GNUnet/src/applications/fs/lib/fslib.c
===================================================================
--- GNUnet/src/applications/fs/lib/fslib.c      2006-12-22 01:29:46 UTC (rev 
4002)
+++ GNUnet/src/applications/fs/lib/fslib.c      2006-12-22 02:00:59 UTC (rev 
4003)
@@ -153,6 +153,7 @@
                      struct MUTEX * lock) {
   SEARCH_CONTEXT * ret;
 
+  GE_ASSERT(ectx, lock != NULL);
   ret = MALLOC(sizeof(SEARCH_CONTEXT));
   ret->ectx = ectx;
   ret->cfg = cfg;
@@ -376,17 +377,25 @@
                 const HashCode512 * fileHc,
                 const char * fn) {
   int ret;
-  CS_fs_request_init_index_MESSAGE *ri;
-  unsigned int size, fnSize;
+  CS_fs_request_init_index_MESSAGE * ri;
+  unsigned int size;
+  size_t fnSize;
 
   fnSize = strlen(fn);
+  fnSize = (fnSize + 7) & (~7); /* align */
   size = sizeof(CS_fs_request_init_index_MESSAGE) + fnSize;
+  GE_ASSERT(NULL, size < 65536);
   ri = MALLOC(size);
+  memset(ri,
+        0,
+        size);
   ri->header.size = htons(size);
   ri->header.type = htons(CS_PROTO_gap_INIT_INDEX);
   ri->reserved = htonl(0);
   ri->fileId = *fileHc;
-  memcpy(&ri[1], fn, fnSize);
+  memcpy(&ri[1], 
+        fn, 
+        strlen(fn));
 
 #if DEBUG_FSLIB
   GE_LOG(ectx, 
@@ -394,7 +403,7 @@
         "Sending index initialization request to gnunetd\n");
 #endif
   if (OK != connection_write(sock,
-        &ri->header)) {
+                            &ri->header)) {
     FREE(ri);
     return SYSERR;
   }

Modified: GNUnet/src/applications/fs/module/ondemand.c
===================================================================
--- GNUnet/src/applications/fs/module/ondemand.c        2006-12-22 01:29:46 UTC 
(rev 4002)
+++ GNUnet/src/applications/fs/module/ondemand.c        2006-12-22 02:00:59 UTC 
(rev 4003)
@@ -140,6 +140,8 @@
   strcat(serverFN,
         (char*)&enc);
   UNLINK(serverFN);
+  disk_directory_create_for_file(cectx,
+                                serverFN);
   if (0 != SYMLINK(fn, serverFN)) {
     GE_LOG_STRERROR_FILE(cectx,
                         GE_ERROR | GE_ADMIN | GE_USER | GE_BULK,





reply via email to

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