gnunet-svn
[Top][All Lists]
Advanced

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

[GNUnet-SVN] r3823 - GNUnet/src/applications/fs/fsui


From: grothoff
Subject: [GNUnet-SVN] r3823 - GNUnet/src/applications/fs/fsui
Date: Wed, 29 Nov 2006 19:49:41 -0800 (PST)

Author: grothoff
Date: 2006-11-29 19:49:36 -0800 (Wed, 29 Nov 2006)
New Revision: 3823

Modified:
   GNUnet/src/applications/fs/fsui/deserialize.c
   GNUnet/src/applications/fs/fsui/download.c
   GNUnet/src/applications/fs/fsui/fsui.c
   GNUnet/src/applications/fs/fsui/search.c
   GNUnet/src/applications/fs/fsui/serialize.c
   GNUnet/src/applications/fs/fsui/serializetest2.c
   GNUnet/src/applications/fs/fsui/upload.c
Log:
fsui bugfixes

Modified: GNUnet/src/applications/fs/fsui/deserialize.c
===================================================================
--- GNUnet/src/applications/fs/fsui/deserialize.c       2006-11-30 01:02:16 UTC 
(rev 3822)
+++ GNUnet/src/applications/fs/fsui/deserialize.c       2006-11-30 03:49:36 UTC 
(rev 3823)
@@ -222,8 +222,8 @@
         0,
         sizeof(FSUI_DownloadList));
   ret->ctx = ctx;
-  if ( (OK != read_int(fd, (int*) &ret->state)) ||
-       (OK != read_int(fd, (int*) &soff)) ||
+  if ( (OK != read_int(fd, (int*) &soff)) ||
+       (OK != read_int(fd, (int*) &ret->state)) ||
        (OK != read_int(fd, (int*) &ret->is_recursive)) ||
        (OK != read_int(fd, (int*) &ret->is_directory)) ||
        (OK != read_int(fd, (int*) &ret->anonymityLevel)) ||
@@ -369,6 +369,7 @@
                        struct FSUI_Context * ctx) {
   int big;
   FSUI_SearchList * list;
+  FSUI_SearchList * last;
   int i;
   ResultPending * rp;
   char * buf;
@@ -477,12 +478,18 @@
     }  
     list->ctx
       = ctx;
+    list->next
+      = NULL;
+    /* finally: append (!) to list */
 
-    /* finally: prepend to list */
-    list->next
-      = ctx->activeSearches;
-    ctx->activeSearches
-      = list;
+    if (ctx->activeSearches == NULL) {
+      ctx->activeSearches = list;
+    } else {
+      last = ctx->activeSearches;
+      while (last->next != NULL)
+       last = last->next;
+      last->next = list;
+    }
   } /* end OUTER: 'while(1)' */
  ERR:
   /* error - deallocate 'list' */

Modified: GNUnet/src/applications/fs/fsui/download.c
===================================================================
--- GNUnet/src/applications/fs/fsui/download.c  2006-11-30 01:02:16 UTC (rev 
3822)
+++ GNUnet/src/applications/fs/fsui/download.c  2006-11-30 03:49:36 UTC (rev 
3823)
@@ -145,7 +145,7 @@
   event.type = FSUI_download_progress;
   event.data.DownloadProgress.dc.pos = dl;
   event.data.DownloadProgress.dc.cctx = dl->cctx;
-  event.data.DownloadProgress.dc.ppos = dl->parent;
+  event.data.DownloadProgress.dc.ppos = dl->parent == 
&dl->ctx->activeDownloads ? NULL : dl->parent;
   event.data.DownloadProgress.dc.pcctx = dl->parent->cctx;
   event.data.DownloadProgress.dc.spos = dl->search;
   event.data.DownloadProgress.dc.sctx = dl->search == NULL ? NULL : 
dl->search->cctx;
@@ -247,7 +247,7 @@
     event.type = FSUI_download_completed;
     event.data.DownloadCompleted.dc.pos = dl;
     event.data.DownloadCompleted.dc.cctx = dl->cctx;
-    event.data.DownloadCompleted.dc.ppos = dl->parent;
+    event.data.DownloadCompleted.dc.ppos = dl->parent == 
&dl->ctx->activeDownloads ? NULL : dl->parent;
     event.data.DownloadCompleted.dc.pcctx = dl->parent->cctx;
     event.data.DownloadCompleted.dc.spos = dl->search;
     event.data.DownloadCompleted.dc.sctx = dl->search == NULL ? NULL : 
dl->search->cctx;
@@ -264,7 +264,7 @@
     event.type = FSUI_download_error;
     event.data.DownloadError.dc.pos = dl;
     event.data.DownloadError.dc.cctx = dl->cctx;
-    event.data.DownloadError.dc.ppos = dl->parent;
+    event.data.DownloadError.dc.ppos = dl->parent == &dl->ctx->activeDownloads 
? NULL : dl->parent;
     event.data.DownloadError.dc.pcctx = dl->parent->cctx;
     event.data.DownloadError.dc.spos = dl->search;
     event.data.DownloadError.dc.sctx = dl->search == NULL ? NULL : 
dl->search->cctx;
@@ -279,7 +279,7 @@
     event.type = FSUI_download_aborted;
     event.data.DownloadAborted.dc.pos = dl;
     event.data.DownloadAborted.dc.cctx = dl->cctx;
-    event.data.DownloadAborted.dc.ppos = dl->parent;
+    event.data.DownloadAborted.dc.ppos = dl->parent == 
&dl->ctx->activeDownloads ? NULL : dl->parent;
     event.data.DownloadAborted.dc.pcctx = dl->parent->cctx;
     event.data.DownloadAborted.dc.spos = dl->search;
     event.data.DownloadAborted.dc.sctx = dl->search == NULL ? NULL : 
dl->search->cctx;
@@ -403,7 +403,7 @@
   event.type = FSUI_download_started;
   event.data.DownloadStarted.dc.pos = dl;
   event.data.DownloadStarted.dc.cctx = NULL;
-  event.data.DownloadStarted.dc.ppos = dl->parent;
+  event.data.DownloadStarted.dc.ppos = dl->parent == &ctx->activeDownloads ? 
NULL : dl->parent;
   event.data.DownloadStarted.dc.pcctx = dl->parent->cctx;
   event.data.DownloadStarted.dc.spos = dl->search;
   event.data.DownloadStarted.dc.sctx = dl->search == NULL ? NULL : 
dl->search->cctx;
@@ -642,7 +642,7 @@
   event.type = FSUI_download_stopped;
   event.data.DownloadStopped.dc.pos = dl;
   event.data.DownloadStopped.dc.cctx = dl->cctx;
-  event.data.DownloadStopped.dc.ppos = dl->parent;
+  event.data.DownloadStopped.dc.ppos = dl->parent == &ctx->activeDownloads ? 
NULL : dl->parent;
   event.data.DownloadStopped.dc.pcctx = dl->parent->cctx;
   event.data.DownloadStopped.dc.spos = dl->search;
   event.data.DownloadStopped.dc.sctx = dl->search == NULL ? NULL : 
dl->search->cctx;

Modified: GNUnet/src/applications/fs/fsui/fsui.c
===================================================================
--- GNUnet/src/applications/fs/fsui/fsui.c      2006-11-30 01:02:16 UTC (rev 
3822)
+++ GNUnet/src/applications/fs/fsui/fsui.c      2006-11-30 03:49:36 UTC (rev 
3823)
@@ -69,7 +69,7 @@
     event.type = FSUI_download_resumed;
     event.data.DownloadResumed.dc.pos = ret;
     event.data.DownloadResumed.dc.cctx = ret->cctx;
-    event.data.DownloadResumed.dc.ppos = ret->parent;
+    event.data.DownloadResumed.dc.ppos = ret->parent == &ctx->activeDownloads 
? NULL : ret->parent;
     event.data.DownloadResumed.dc.pcctx = ret->parent->cctx;
     event.data.DownloadResumed.dc.spos = ret->search;
     event.data.DownloadResumed.dc.sctx = ret->search == NULL ? NULL : 
ret->search->cctx;
@@ -329,7 +329,7 @@
     event.type = FSUI_download_suspended;
     event.data.DownloadSuspended.dc.pos = list;
     event.data.DownloadSuspended.dc.cctx = list->cctx;
-    event.data.DownloadSuspended.dc.ppos = list->parent;
+    event.data.DownloadSuspended.dc.ppos = list->parent == 
&ctx->activeDownloads ? NULL : list->parent;
     event.data.DownloadSuspended.dc.pcctx = list->parent->cctx;
     event.data.DownloadSuspended.dc.spos = list->search;
     event.data.DownloadSuspended.dc.sctx = list->search == NULL ? NULL : 
list->search->cctx;

Modified: GNUnet/src/applications/fs/fsui/search.c
===================================================================
--- GNUnet/src/applications/fs/fsui/search.c    2006-11-30 01:02:16 UTC (rev 
3822)
+++ GNUnet/src/applications/fs/fsui/search.c    2006-11-30 03:49:36 UTC (rev 
3823)
@@ -405,6 +405,11 @@
     ctx->activeSearches = pos->next;
   else
     prev->next = pos->next;
+  for (i=0;i<sl->my_downloads_size;i++) 
+    sl->my_downloads[i]->search = NULL;
+  GROW(sl->my_downloads,
+       sl->my_downloads_size,
+       0);
   MUTEX_UNLOCK(ctx->lock);
   pos->next = NULL;
   if ( (pos->state == FSUI_ACTIVE) ||

Modified: GNUnet/src/applications/fs/fsui/serialize.c
===================================================================
--- GNUnet/src/applications/fs/fsui/serialize.c 2006-11-30 01:02:16 UTC (rev 
3822)
+++ GNUnet/src/applications/fs/fsui/serialize.c 2006-11-30 03:49:36 UTC (rev 
3823)
@@ -130,7 +130,9 @@
     i = 1;
     pos = ctx->activeSearches;
     while (pos != list->search) {
-      i++;
+      if ( (pos->sizeResultsReceived <= 1024 * 1024) &&
+          (pos->sizeUnmatchedResultsReceived <= 1024 * 1024) ) 
+       i++;
       pos = pos->next;
       if (pos == NULL) {
        GE_BREAK(ectx, 0);
@@ -138,6 +140,10 @@
        break;
       }
     }
+    if ( (pos != NULL) &&
+        ( (pos->sizeResultsReceived < 1024 * 1024) ||
+          (pos->sizeUnmatchedResultsReceived < 1024 * 1024) ) )
+      i = 0;
     WRITEINT(fd, i);
   }
   WRITEINT(fd, list->state);

Modified: GNUnet/src/applications/fs/fsui/serializetest2.c
===================================================================
--- GNUnet/src/applications/fs/fsui/serializetest2.c    2006-11-30 01:02:16 UTC 
(rev 3822)
+++ GNUnet/src/applications/fs/fsui/serializetest2.c    2006-11-30 03:49:36 UTC 
(rev 3823)
@@ -89,7 +89,9 @@
     if ( (event->data.DownloadSuspended.dc.pos != download) &&
         (event->data.DownloadSuspended.dc.ppos != download) ) {
       fprintf(stderr,
-             "Download suspended but parent reference not set correctly.\n");
+             "Download suspended but parent reference not set correctly (%p 
instead of %p).\n",
+             event->data.DownloadSuspended.dc.ppos,
+             download);
       have_error = 1;
     }
     if ( (event->data.DownloadSuspended.dc.pos != download) &&
@@ -150,6 +152,8 @@
 #endif
     break;
   case FSUI_upload_completed:
+    if (upURI != NULL)
+      ECRS_freeUri(upURI);
     upURI = ECRS_dupUri(event->data.UploadCompleted.uri);
 #if DEBUG_VERBOSE
     printf("Upload complete.\n");
@@ -250,6 +254,8 @@
 #endif
     break;
   case FSUI_download_started:
+    if (download == NULL)
+      download = event->data.DownloadStarted.dc.pos;
     if ( (event->data.DownloadStarted.dc.pos == download) &&
         (event->data.DownloadStarted.dc.spos != search) ) {
       fprintf(stderr,
@@ -319,7 +325,7 @@
 
 #define FILESIZE (1024)
 
-#define START_DAEMON 1
+#define START_DAEMON 0
 
 int main(int argc, char * argv[]){
 #if START_DAEMON
@@ -429,7 +435,7 @@
                                YES,
                                upURI,
                                meta,
-                               fn,
+                               UPLOAD_PREFIX "-download",
                                search,
                                NULL);
   ECRS_freeMetaData(meta);

Modified: GNUnet/src/applications/fs/fsui/upload.c
===================================================================
--- GNUnet/src/applications/fs/fsui/upload.c    2006-11-30 01:02:16 UTC (rev 
3822)
+++ GNUnet/src/applications/fs/fsui/upload.c    2006-11-30 03:49:36 UTC (rev 
3823)
@@ -370,6 +370,8 @@
   if (utc->child != NULL)
     UNLINK(filename);
   FREE(filename);
+  GE_free_context(ee);
+  GE_memory_free(mem);
   return NULL;
 }
 





reply via email to

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