gnunet-svn
[Top][All Lists]
Advanced

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

[GNUnet-SVN] r3772 - in GNUnet/src/applications: fs/fsui session


From: grothoff
Subject: [GNUnet-SVN] r3772 - in GNUnet/src/applications: fs/fsui session
Date: Tue, 14 Nov 2006 19:40:22 -0800 (PST)

Author: grothoff
Date: 2006-11-14 19:40:09 -0800 (Tue, 14 Nov 2006)
New Revision: 3772

Modified:
   GNUnet/src/applications/fs/fsui/download.c
   GNUnet/src/applications/fs/fsui/search.c
   GNUnet/src/applications/fs/fsui/unindex.c
   GNUnet/src/applications/fs/fsui/upload.c
   GNUnet/src/applications/session/sessiontest.c
Log:
extra checks

Modified: GNUnet/src/applications/fs/fsui/download.c
===================================================================
--- GNUnet/src/applications/fs/fsui/download.c  2006-11-15 02:46:13 UTC (rev 
3771)
+++ GNUnet/src/applications/fs/fsui/download.c  2006-11-15 03:40:09 UTC (rev 
3772)
@@ -513,6 +513,7 @@
     PTHREAD_STOP_SLEEP(list->handle);
     PTHREAD_JOIN(list->handle,
                 &unused);
+    list->handle = NULL;
     list->ctx->activeDownloadThreads--;
     list->state = FSUI_PENDING;
     ret = YES;
@@ -530,6 +531,7 @@
 #endif
     PTHREAD_JOIN(list->handle,
                 &unused);
+    list->handle = NULL;
     list->ctx->activeDownloadThreads--;
     list->state++; /* adds _JOINED */
     ret = YES;
@@ -608,12 +610,20 @@
   else
     prev->next = dl->next; /* not first child */
   MUTEX_UNLOCK(ctx->lock);
-  if ( (dl->state == FSUI_COMPLETED) ||
+  if ( (dl->state == FSUI_ACTIVE) ||
+       (dl->state == FSUI_COMPLETED) ||
        (dl->state == FSUI_ABORTED) ||
        (dl->state == FSUI_ERROR) ) {
+    GE_ASSERT(ctx->ectx, dl->handle != NULL);
     PTHREAD_JOIN(dl->handle,
                 &unused);
-    dl->state++; /* add _JOINED */
+    dl->handle = NULL;
+    if (dl->state == FSUI_ACTIVE) 
+      dl->state = FSUI_PENDING;
+    else
+      dl->state++; /* add _JOINED */
+  } else {
+    GE_ASSERT(ctx->ectx, dl->handle == NULL);
   }
   event.type = FSUI_download_stopped;
   event.data.DownloadStopped.dc.pos = dl;

Modified: GNUnet/src/applications/fs/fsui/search.c
===================================================================
--- GNUnet/src/applications/fs/fsui/search.c    2006-11-15 02:46:13 UTC (rev 
3771)
+++ GNUnet/src/applications/fs/fsui/search.c    2006-11-15 03:40:09 UTC (rev 
3772)
@@ -339,6 +339,7 @@
                    "PTHREAD_CREATE");
     ECRS_freeUri(pos->uri);
     FREE(pos);
+    pos->state = FSUI_ERROR_JOINED;
     MUTEX_UNLOCK(ctx->lock);
     return NULL;
   }
@@ -393,12 +394,20 @@
     prev->next = pos->next;
   MUTEX_UNLOCK(ctx->lock);
   pos->next = NULL;
-  if ( (pos->state == FSUI_COMPLETED) ||
+  if ( (pos->state == FSUI_ACTIVE) ||
+       (pos->state == FSUI_COMPLETED) ||
        (pos->state == FSUI_ABORTED) ||
        (pos->state == FSUI_ERROR) ) {
+    GE_ASSERT(ctx->ectx, pos->handle != NULL);
     PTHREAD_JOIN(pos->handle,
                 &unused);
-    pos->state++; /* add _JOINED */
+    pos->handle = NULL;
+    if (pos->state == FSUI_ACTIVE)
+      pos->state = FSUI_PENDING;
+    else
+      pos->state++; /* add _JOINED */
+  } else {
+    GE_ASSERT(ctx->ectx, pos->handle == NULL);
   }
   event.type = FSUI_search_stopped;
   event.data.SearchStopped.sc.pos = pos;

Modified: GNUnet/src/applications/fs/fsui/unindex.c
===================================================================
--- GNUnet/src/applications/fs/fsui/unindex.c   2006-11-15 02:46:13 UTC (rev 
3771)
+++ GNUnet/src/applications/fs/fsui/unindex.c   2006-11-15 03:40:09 UTC (rev 
3772)
@@ -254,12 +254,20 @@
     prev->next = dl->next;
   }
   MUTEX_UNLOCK(ctx->lock);
-  if ( (dl->state == FSUI_COMPLETED) ||
+  if ( (dl->state == FSUI_ACTIVE) ||
+       (dl->state == FSUI_COMPLETED) ||
        (dl->state == FSUI_ABORTED) ||
        (dl->state == FSUI_ERROR) ) {
+    GE_ASSERT(ctx->ectx, dl->handle != NULL);
     PTHREAD_JOIN(dl->handle,
                 &unused);
-    dl->state++; /* add _JOINED */
+    dl->handle = NULL;
+    if (dl->state == FSUI_ACTIVE)
+      dl->state = FSUI_PENDING;
+    else
+      dl->state++; /* add _JOINED */
+  } else {
+    GE_ASSERT(ctx->ectx, dl->handle == NULL);
   }
   event.type = FSUI_unindex_stopped;
   event.data.UnindexStopped.uc.pos = dl;

Modified: GNUnet/src/applications/fs/fsui/upload.c
===================================================================
--- GNUnet/src/applications/fs/fsui/upload.c    2006-11-15 02:46:13 UTC (rev 
3771)
+++ GNUnet/src/applications/fs/fsui/upload.c    2006-11-15 03:40:09 UTC (rev 
3772)
@@ -633,12 +633,20 @@
 
   GE_ASSERT(ctx->ectx, ul != NULL);
   GE_ASSERT(ctx->ectx, ul->parent == &ctx->activeUploads);
-  if ( (ul->state == FSUI_COMPLETED) ||
+  if ( (ul->state == FSUI_ACTIVE) ||
+       (ul->state == FSUI_COMPLETED) ||
        (ul->state == FSUI_ABORTED) ||
        (ul->state == FSUI_ERROR) ) {
+    GE_ASSERT(ctx->ectx, ul->shared->handle != NULL);
     PTHREAD_JOIN(ul->shared->handle,
                 &unused);
-    ul->state++; /* add _JOINED */
+    ul->shared->handle = NULL;
+    if (ul->state == FSUI_ACTIVE)
+      ul->state = FSUI_PENDING;
+    else
+      ul->state++; /* add _JOINED */
+  } else {
+    GE_ASSERT(ctx->ectx, ul->shared->handle == NULL);
   }
   signalUploadStopped(ul, 1);
   shared = ul->shared;

Modified: GNUnet/src/applications/session/sessiontest.c
===================================================================
--- GNUnet/src/applications/session/sessiontest.c       2006-11-15 02:46:13 UTC 
(rev 3771)
+++ GNUnet/src/applications/session/sessiontest.c       2006-11-15 03:40:09 UTC 
(rev 3772)
@@ -31,7 +31,7 @@
 #include "gnunet_util_network_client.h"
 #include "gnunet_stats_lib.h"
 
-#define START_PEERS 0
+#define START_PEERS 1
 
 static int ok;
 





reply via email to

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