gnunet-svn
[Top][All Lists]
Advanced

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

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


From: gnunet
Subject: [GNUnet-SVN] r6746 - in GNUnet/src: applications/fs/fsui applications/fs/tools include
Date: Wed, 23 Apr 2008 23:59:41 -0600 (MDT)

Author: grothoff
Date: 2008-04-23 23:59:41 -0600 (Wed, 23 Apr 2008)
New Revision: 6746

Modified:
   GNUnet/src/applications/fs/fsui/deserialize.c
   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/fs/tools/gnunet-auto-share.c
   GNUnet/src/applications/fs/tools/gnunet-download.c
   GNUnet/src/applications/fs/tools/gnunet-insert.c
   GNUnet/src/applications/fs/tools/gnunet-search.c
   GNUnet/src/applications/fs/tools/gnunet-unindex.c
   GNUnet/src/include/gnunet_fsui_lib.h
Log:
simplied FSUI stop/abort API

Modified: GNUnet/src/applications/fs/fsui/deserialize.c
===================================================================
--- GNUnet/src/applications/fs/fsui/deserialize.c       2008-04-24 05:49:31 UTC 
(rev 6745)
+++ GNUnet/src/applications/fs/fsui/deserialize.c       2008-04-24 05:59:41 UTC 
(rev 6746)
@@ -652,7 +652,6 @@
                                               total_searches,
                                               srla);
       GNUNET_free(srla);
-      list->ctx = ctx;
       list->next = NULL;
 
       /* finally: append (!) to list */

Modified: GNUnet/src/applications/fs/fsui/download.c
===================================================================
--- GNUnet/src/applications/fs/fsui/download.c  2008-04-24 05:49:31 UTC (rev 
6745)
+++ GNUnet/src/applications/fs/fsui/download.c  2008-04-24 05:59:41 UTC (rev 
6746)
@@ -553,17 +553,19 @@
  *         GNUNET_NO if the download has already finished
  */
 int
-GNUNET_FSUI_download_abort (struct GNUNET_FSUI_Context *ctx,
-                            struct GNUNET_FSUI_DownloadList *dl)
+GNUNET_FSUI_download_abort (struct GNUNET_FSUI_DownloadList *dl)
 {
+  struct GNUNET_FSUI_Context *ctx;
   struct GNUNET_FSUI_DownloadList *c;
   GNUNET_FSUI_Event event;
 
-  GNUNET_GE_ASSERT (ctx->ectx, dl != NULL);
+  if (dl == NULL)
+    return GNUNET_SYSERR;
+  ctx = dl->ctx;
   c = dl->child;
   while (c != NULL)
     {
-      GNUNET_FSUI_download_abort (ctx, c);
+      GNUNET_FSUI_download_abort (c);
       c = c->next;
     }
   if ((dl->state != GNUNET_FSUI_ACTIVE) && (dl->state != GNUNET_FSUI_PENDING))
@@ -605,16 +607,18 @@
  * @return GNUNET_SYSERR if no such download is pending
  */
 int
-GNUNET_FSUI_download_stop (struct GNUNET_FSUI_Context *ctx,
-                           struct GNUNET_FSUI_DownloadList *dl)
+GNUNET_FSUI_download_stop (struct GNUNET_FSUI_DownloadList *dl)
 {
   struct GNUNET_FSUI_DownloadList *prev;
+  struct GNUNET_FSUI_Context *ctx;
   GNUNET_FSUI_Event event;
   int i;
 
-  GNUNET_GE_ASSERT (ctx->ectx, dl != NULL);
+  if (dl == NULL)
+    return GNUNET_SYSERR;
+  ctx = dl->ctx;
   while (dl->child != NULL)
-    GNUNET_FSUI_download_stop (ctx, dl->child);
+    GNUNET_FSUI_download_stop (dl->child);
   GNUNET_mutex_lock (ctx->lock);
   prev =
     (dl->parent != NULL) ? dl->parent->child : ctx->activeDownloads.child;

Modified: GNUnet/src/applications/fs/fsui/search.c
===================================================================
--- GNUnet/src/applications/fs/fsui/search.c    2008-04-24 05:49:31 UTC (rev 
6745)
+++ GNUnet/src/applications/fs/fsui/search.c    2008-04-24 05:59:41 UTC (rev 
6746)
@@ -332,13 +332,14 @@
  * Abort a search.
  */
 int
-GNUNET_FSUI_search_abort (struct GNUNET_FSUI_Context *ctx,
-                          struct GNUNET_FSUI_SearchList *sl)
+GNUNET_FSUI_search_abort (struct GNUNET_FSUI_SearchList *sl)
 {
   GNUNET_FSUI_Event event;
   struct SearchRecordList * rec;
   struct SearchResultList * srl;
+  struct GNUNET_FSUI_Context *ctx;
 
+  ctx = sl->ctx;
   GNUNET_mutex_lock (ctx->lock);
   if (sl->state == GNUNET_FSUI_PENDING)
     {
@@ -390,13 +391,14 @@
  * Pause a search.
  */
 int
-GNUNET_FSUI_search_pause (struct GNUNET_FSUI_Context *ctx,
-                          struct GNUNET_FSUI_SearchList *sl)
+GNUNET_FSUI_search_pause (struct GNUNET_FSUI_SearchList *sl)
 {
   GNUNET_FSUI_Event event;
   struct SearchRecordList * rec;
   struct SearchResultList * srl;
+  struct GNUNET_FSUI_Context *ctx;
 
+  ctx = sl->ctx;
   GNUNET_mutex_lock (ctx->lock);
   if (sl->state != GNUNET_FSUI_ACTIVE)
     {
@@ -437,12 +439,13 @@
  * Restart a paused search.
  */
 int
-GNUNET_FSUI_search_restart (struct GNUNET_FSUI_Context *ctx,
-                            struct GNUNET_FSUI_SearchList *pos)
+GNUNET_FSUI_search_restart (struct GNUNET_FSUI_SearchList *pos)
 {
   GNUNET_FSUI_Event event;
   struct SearchRecordList * rec;
+  struct GNUNET_FSUI_Context *ctx;
 
+  ctx = pos->ctx;
   GNUNET_mutex_lock (ctx->lock);
   pos->state = GNUNET_FSUI_ACTIVE;
   event.type = GNUNET_FSUI_search_restarted;
@@ -465,7 +468,7 @@
   if (rec != NULL)
     {
       /* failed to restart, auto-pause again */
-      GNUNET_FSUI_search_pause(ctx, pos);
+      GNUNET_FSUI_search_pause(pos);
       GNUNET_mutex_unlock (ctx->lock);
       return GNUNET_SYSERR;
     }
@@ -477,8 +480,7 @@
  * Stop a search.
  */
 int
-GNUNET_FSUI_search_stop (struct GNUNET_FSUI_Context *ctx,
-                         struct GNUNET_FSUI_SearchList *sl)
+GNUNET_FSUI_search_stop (struct GNUNET_FSUI_SearchList *sl)
 {
   GNUNET_FSUI_Event event;
   GNUNET_FSUI_SearchList *pos;
@@ -486,10 +488,12 @@
   int i;
   struct SearchRecordList * rec;
   struct SearchResultList * srl;
+  struct GNUNET_FSUI_Context *ctx;
 
+  ctx = sl->ctx;
   GNUNET_mutex_lock (ctx->lock);
   if (sl->state == GNUNET_FSUI_ACTIVE)
-    GNUNET_FSUI_search_abort (ctx, sl);
+    GNUNET_FSUI_search_abort (sl);
   prev = NULL;
   pos = ctx->activeSearches;
   while ((pos != sl) && (pos != NULL))

Modified: GNUnet/src/applications/fs/fsui/unindex.c
===================================================================
--- GNUnet/src/applications/fs/fsui/unindex.c   2008-04-24 05:49:31 UTC (rev 
6745)
+++ GNUnet/src/applications/fs/fsui/unindex.c   2008-04-24 05:59:41 UTC (rev 
6746)
@@ -220,8 +220,7 @@
  * @return GNUNET_SYSERR if no such unindex is pending
  */
 int
-GNUNET_FSUI_unindex_abort (struct GNUNET_FSUI_Context *ctx,
-                           struct GNUNET_FSUI_UnindexList *ul)
+GNUNET_FSUI_unindex_abort (struct GNUNET_FSUI_UnindexList *ul)
 {
   if ((ul->state != GNUNET_FSUI_ACTIVE) && (ul->state != GNUNET_FSUI_PENDING))
     return GNUNET_NO;
@@ -244,14 +243,15 @@
  * @return GNUNET_SYSERR if no such unindex is pending
  */
 int
-GNUNET_FSUI_unindex_stop (struct GNUNET_FSUI_Context *ctx,
-                          struct GNUNET_FSUI_UnindexList *dl)
+GNUNET_FSUI_unindex_stop (struct GNUNET_FSUI_UnindexList *dl)
 {
   GNUNET_FSUI_UnindexList *prev;
+  struct GNUNET_FSUI_Context *ctx;
   struct GNUNET_GE_Context *ectx;
   void *unused;
   GNUNET_FSUI_Event event;
 
+  ctx = dl->ctx;
   ectx = ctx->ectx;
   if (dl == NULL)
     {

Modified: GNUnet/src/applications/fs/fsui/upload.c
===================================================================
--- GNUnet/src/applications/fs/fsui/upload.c    2008-04-24 05:49:31 UTC (rev 
6745)
+++ GNUnet/src/applications/fs/fsui/upload.c    2008-04-24 05:59:41 UTC (rev 
6746)
@@ -816,12 +816,14 @@
  * @return GNUNET_SYSERR on error
  */
 int
-GNUNET_FSUI_upload_abort (struct GNUNET_FSUI_Context *ctx,
-                          struct GNUNET_FSUI_UploadList *ul)
+GNUNET_FSUI_upload_abort (struct GNUNET_FSUI_UploadList *ul)
 {
   GNUNET_FSUI_UploadList *c;
+  struct GNUNET_FSUI_Context *ctx;
 
-  GNUNET_GE_ASSERT (ctx->ectx, ul != NULL);
+  if (ul == NULL)
+    return GNUNET_SYSERR;
+  ctx = ul->shared->ctx;
   if ((ul->state != GNUNET_FSUI_ACTIVE) && (ul->state != GNUNET_FSUI_PENDING))
     return GNUNET_NO;
   if (ul->state == GNUNET_FSUI_ACTIVE)
@@ -830,7 +832,7 @@
       c = ul->child;
       while (c != NULL)
         {
-          GNUNET_FSUI_upload_abort (ctx, c);
+          GNUNET_FSUI_upload_abort (c);
           c = c->next;
         }
       GNUNET_thread_stop_sleep (ul->shared->handle);
@@ -841,7 +843,7 @@
       c = ul->child;
       while (c != NULL)
         {
-          GNUNET_FSUI_upload_abort (ctx, c);
+          GNUNET_FSUI_upload_abort (c);
           c = c->next;
         }
     }
@@ -855,13 +857,15 @@
  * @return GNUNET_SYSERR on error
  */
 int
-GNUNET_FSUI_upload_stop (struct GNUNET_FSUI_Context *ctx,
-                         struct GNUNET_FSUI_UploadList *ul)
+GNUNET_FSUI_upload_stop (struct GNUNET_FSUI_UploadList *ul)
 {
   void *unused;
   struct GNUNET_FSUI_UploadShared *shared;
-
-  GNUNET_GE_ASSERT (ctx->ectx, ul != NULL);
+  struct GNUNET_FSUI_Context *ctx;
+  
+  if (ul == NULL)
+    return GNUNET_SYSERR;
+  ctx = ul->shared->ctx;
   GNUNET_GE_ASSERT (ctx->ectx, ul->parent == &ctx->activeUploads);
   if ((ul->state == GNUNET_FSUI_ACTIVE) ||
       (ul->state == GNUNET_FSUI_COMPLETED) ||

Modified: GNUnet/src/applications/fs/tools/gnunet-auto-share.c
===================================================================
--- GNUnet/src/applications/fs/tools/gnunet-auto-share.c        2008-04-24 
05:49:31 UTC (rev 6745)
+++ GNUnet/src/applications/fs/tools/gnunet-auto-share.c        2008-04-24 
05:59:41 UTC (rev 6746)
@@ -400,8 +400,8 @@
       GNUNET_disk_directory_scan (ectx, dirname, &probe_directory, NULL);
       if (GNUNET_YES == upload_done)
         {
-          GNUNET_FSUI_upload_abort (ctx, ul);
-          GNUNET_FSUI_upload_stop (ctx, ul);
+          GNUNET_FSUI_upload_abort (ul);
+          GNUNET_FSUI_upload_stop (ul);
           upload_done = GNUNET_NO;
           ul = NULL;
         }

Modified: GNUnet/src/applications/fs/tools/gnunet-download.c
===================================================================
--- GNUnet/src/applications/fs/tools/gnunet-download.c  2008-04-24 05:49:31 UTC 
(rev 6745)
+++ GNUnet/src/applications/fs/tools/gnunet-download.c  2008-04-24 05:59:41 UTC 
(rev 6746)
@@ -384,10 +384,10 @@
   if (do_delete_incomplete)
     {
       for (i = 0; i < downloads_size; i++)
-        GNUNET_FSUI_download_abort (ctx, downloads[i]);
+        GNUNET_FSUI_download_abort (downloads[i]);
     }
   for (i = 0; i < downloads_size; i++)
-    GNUNET_FSUI_download_stop (ctx, downloads[i]);
+    GNUNET_FSUI_download_stop (downloads[i]);
   GNUNET_array_grow (downloads, downloads_size, 0);
   GNUNET_FSUI_stop (ctx);
   GNUNET_mutex_destroy (lock);

Modified: GNUnet/src/applications/fs/tools/gnunet-insert.c
===================================================================
--- GNUnet/src/applications/fs/tools/gnunet-insert.c    2008-04-24 05:49:31 UTC 
(rev 6745)
+++ GNUnet/src/applications/fs/tools/gnunet-insert.c    2008-04-24 05:59:41 UTC 
(rev 6746)
@@ -569,8 +569,8 @@
     {
       GNUNET_shutdown_wait_for ();
       if (errorCode == 1)
-        GNUNET_FSUI_upload_abort (ctx, ul);
-      GNUNET_FSUI_upload_stop (ctx, ul);
+        GNUNET_FSUI_upload_abort (ul);
+      GNUNET_FSUI_upload_stop (ul);
     }
   GNUNET_FSUI_stop (ctx);
 quit:

Modified: GNUnet/src/applications/fs/tools/gnunet-search.c
===================================================================
--- GNUnet/src/applications/fs/tools/gnunet-search.c    2008-04-24 05:49:31 UTC 
(rev 6745)
+++ GNUnet/src/applications/fs/tools/gnunet-search.c    2008-04-24 05:59:41 UTC 
(rev 6746)
@@ -189,8 +189,8 @@
     }
   GNUNET_shutdown_wait_for ();
   if (errorCode == 1)
-    GNUNET_FSUI_search_abort (ctx, s);
-  GNUNET_FSUI_search_stop (ctx, s);
+    GNUNET_FSUI_search_abort (s);
+  GNUNET_FSUI_search_stop (s);
   GNUNET_FSUI_stop (ctx);
 
   if (output_filename != NULL)

Modified: GNUnet/src/applications/fs/tools/gnunet-unindex.c
===================================================================
--- GNUnet/src/applications/fs/tools/gnunet-unindex.c   2008-04-24 05:49:31 UTC 
(rev 6745)
+++ GNUnet/src/applications/fs/tools/gnunet-unindex.c   2008-04-24 05:59:41 UTC 
(rev 6746)
@@ -168,8 +168,8 @@
     {
       GNUNET_shutdown_wait_for ();
       if (errorCode == 1)
-        GNUNET_FSUI_unindex_abort (ctx, ul);
-      GNUNET_FSUI_unindex_stop (ctx, ul);
+        GNUNET_FSUI_unindex_abort (ul);
+      GNUNET_FSUI_unindex_stop (ul);
     }
   GNUNET_free (filename);
   GNUNET_FSUI_stop (ctx);

Modified: GNUnet/src/include/gnunet_fsui_lib.h
===================================================================
--- GNUnet/src/include/gnunet_fsui_lib.h        2008-04-24 05:49:31 UTC (rev 
6745)
+++ GNUnet/src/include/gnunet_fsui_lib.h        2008-04-24 05:59:41 UTC (rev 
6746)
@@ -902,28 +902,28 @@
  *
  * @return GNUNET_SYSERR if such a search is not known
  */
-int GNUNET_FSUI_search_abort (struct GNUNET_FSUI_Context *ctx, struct 
GNUNET_FSUI_SearchList *sl);      /* search.c */
+int GNUNET_FSUI_search_abort (struct GNUNET_FSUI_SearchList *sl);      /* 
search.c */
 
 /**
  * Pause a search.
  *
  * @return GNUNET_SYSERR if such a search is not known
  */
-int GNUNET_FSUI_search_pause (struct GNUNET_FSUI_Context *ctx, struct 
GNUNET_FSUI_SearchList *sl);      /* search.c */
+int GNUNET_FSUI_search_pause (struct GNUNET_FSUI_SearchList *sl);      /* 
search.c */
 
 /**
  * Restart a paused search.
  *
  * @return GNUNET_SYSERR if such a search is not known
  */
-int GNUNET_FSUI_search_restart (struct GNUNET_FSUI_Context *ctx, struct 
GNUNET_FSUI_SearchList *sl);    /* search.c */
+int GNUNET_FSUI_search_restart (struct GNUNET_FSUI_SearchList *sl);    /* 
search.c */
 
 /**
  * Stop a search.
  *
  * @return GNUNET_SYSERR if such a search is not known
  */
-int GNUNET_FSUI_search_stop (struct GNUNET_FSUI_Context *ctx, struct 
GNUNET_FSUI_SearchList *sl);       /* search.c */
+int GNUNET_FSUI_search_stop (struct GNUNET_FSUI_SearchList *sl);       /* 
search.c */
 
 /**
  * Start to download a file or directory.
@@ -943,7 +943,7 @@
  *
  * @return GNUNET_SYSERR on error
  */
-int GNUNET_FSUI_download_abort (struct GNUNET_FSUI_Context *ctx, struct 
GNUNET_FSUI_DownloadList *dl);  /* download.c */
+int GNUNET_FSUI_download_abort (struct GNUNET_FSUI_DownloadList *dl);  /* 
download.c */
 
 /**
  * Stop a download.  If the dl is for a recursive
@@ -951,7 +951,7 @@
  *
  * @return GNUNET_SYSERR on error
  */
-int GNUNET_FSUI_download_stop (struct GNUNET_FSUI_Context *ctx, struct 
GNUNET_FSUI_DownloadList *dl);   /* download.c */
+int GNUNET_FSUI_download_stop (struct GNUNET_FSUI_DownloadList *dl);   /* 
download.c */
 
 /**
  * Method that can be used to select files that
@@ -1014,8 +1014,7 @@
  *
  * @return GNUNET_SYSERR on error
  */
-int GNUNET_FSUI_upload_abort (struct GNUNET_FSUI_Context *ctx,
-                              struct GNUNET_FSUI_UploadList *ul);
+int GNUNET_FSUI_upload_abort (struct GNUNET_FSUI_UploadList *ul);
 
 /**
  * Stop an upload.  Only to be called for the top-level
@@ -1023,8 +1022,7 @@
  *
  * @return GNUNET_SYSERR on error
  */
-int GNUNET_FSUI_upload_stop (struct GNUNET_FSUI_Context *ctx,
-                             struct GNUNET_FSUI_UploadList *ul);
+int GNUNET_FSUI_upload_stop (struct GNUNET_FSUI_UploadList *ul);
 
 
 /**
@@ -1045,8 +1043,7 @@
  *
  * @return GNUNET_SYSERR on error
  */
-int GNUNET_FSUI_unindex_abort (struct GNUNET_FSUI_Context *ctx,
-                               struct GNUNET_FSUI_UnindexList *ul);
+int GNUNET_FSUI_unindex_abort (struct GNUNET_FSUI_UnindexList *ul);
 
 
 /**
@@ -1054,8 +1051,7 @@
  *
  * @return GNUNET_SYSERR on error
  */
-int GNUNET_FSUI_unindex_stop (struct GNUNET_FSUI_Context *ctx,
-                              struct GNUNET_FSUI_UnindexList *ul);
+int GNUNET_FSUI_unindex_stop (struct GNUNET_FSUI_UnindexList *ul);
 
 
 #if 0                           /* keep Emacsens' auto-indent happy */





reply via email to

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