[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r30549 - gnunet-gtk/src/fs
From: |
gnunet |
Subject: |
[GNUnet-SVN] r30549 - gnunet-gtk/src/fs |
Date: |
Tue, 5 Nov 2013 23:19:28 +0100 |
Author: grothoff
Date: 2013-11-05 23:19:28 +0100 (Tue, 05 Nov 2013)
New Revision: 30549
Modified:
gnunet-gtk/src/fs/gnunet-fs-gtk.c
gnunet-gtk/src/fs/gnunet-fs-gtk_event-handler.c
gnunet-gtk/src/fs/gnunet-fs-gtk_event-handler.h
Log:
-cancel manually started probes before stopping FS
Modified: gnunet-gtk/src/fs/gnunet-fs-gtk.c
===================================================================
--- gnunet-gtk/src/fs/gnunet-fs-gtk.c 2013-11-05 21:15:15 UTC (rev 30548)
+++ gnunet-gtk/src/fs/gnunet-fs-gtk.c 2013-11-05 22:19:28 UTC (rev 30549)
@@ -230,14 +230,24 @@
* @param tc scheduler context, unused
*/
static void
-shutdown_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+shutdown_task (void *cls,
+ const struct GNUNET_SCHEDULER_TaskContext *tc)
{
struct SearchLookup *sl;
struct PseuLookupContext *lctx;
+ struct SearchResult *sr;
GNUNET_GTK_tray_icon_destroy ();
- if (fs != NULL)
+ while (NULL != (sr = pl_head))
{
+ GNUNET_FS_probe_stop (sr->probe);
+ sr->probe = NULL;
+ GNUNET_CONTAINER_DLL_remove (pl_head,
+ pl_tail,
+ sr);
+ }
+ if (NULL != fs)
+ {
GNUNET_FS_stop (fs);
fs = NULL;
}
Modified: gnunet-gtk/src/fs/gnunet-fs-gtk_event-handler.c
===================================================================
--- gnunet-gtk/src/fs/gnunet-fs-gtk_event-handler.c 2013-11-05 21:15:15 UTC
(rev 30548)
+++ gnunet-gtk/src/fs/gnunet-fs-gtk_event-handler.c 2013-11-05 22:19:28 UTC
(rev 30549)
@@ -246,6 +246,16 @@
/**
+ * Head of search results with a manually-activated probe.
+ */
+struct SearchResult *pl_head;
+
+/**
+ * Tail of search results with a manually-activated probe.
+ */
+struct SearchResult *pl_tail;
+
+/**
* Head of linked list of tabs for searches.
*/
static struct SearchTab *search_tab_head;
@@ -1722,7 +1732,13 @@
GNUNET_CONTAINER_meta_data_destroy (meta);
gtk_tree_row_reference_free (sr->rr);
if (NULL != sr->probe)
+ {
GNUNET_FS_probe_stop (sr->probe);
+ sr->probe = NULL;
+ GNUNET_CONTAINER_DLL_remove (pl_head,
+ pl_tail,
+ sr);
+ }
GNUNET_free (sr);
/* get ready for removal of the tree */
gtk_tree_store_set (GTK_TREE_STORE (tm), &child,
@@ -1781,7 +1797,13 @@
GNUNET_CONTAINER_meta_data_destroy (meta);
gtk_tree_row_reference_free (sr->rr);
if (NULL != sr->probe)
+ {
GNUNET_FS_probe_stop (sr->probe);
+ sr->probe = NULL;
+ GNUNET_CONTAINER_DLL_remove (pl_head,
+ pl_tail,
+ sr);
+ }
GNUNET_free (sr);
move_downloads_in_subtree (tm, &iter);
GNUNET_FS_GTK_remove_treestore_subtree (GTK_TREE_STORE (tm), &iter);
@@ -2317,11 +2339,16 @@
sr = GNUNET_new (struct SearchResult);
sr->result = result;
if (NULL == result)
+ {
sr->probe = GNUNET_FS_probe (GNUNET_FS_GTK_get_fs_handle (),
uri,
meta,
sr,
anonymity);
+ GNUNET_CONTAINER_DLL_insert (pl_head,
+ pl_tail,
+ sr);
+ }
sr->tab = tab;
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Allocated a search result SR=%p\n",
@@ -3142,6 +3169,11 @@
download in the URI tab */
de->sr = GNUNET_GTK_add_to_uri_tab (anonymity,
meta, uri);
+ GNUNET_FS_probe_stop (de->sr->probe);
+ de->sr->probe = NULL;
+ GNUNET_CONTAINER_DLL_remove (pl_head,
+ pl_tail,
+ de->sr);
de->sr->download = de;
path = gtk_tree_row_reference_get_path (de->sr->rr);
if (! gtk_tree_model_get_iter (GTK_TREE_MODEL (de->sr->tab->ts), &iter,
path))
Modified: gnunet-gtk/src/fs/gnunet-fs-gtk_event-handler.h
===================================================================
--- gnunet-gtk/src/fs/gnunet-fs-gtk_event-handler.h 2013-11-05 21:15:15 UTC
(rev 30548)
+++ gnunet-gtk/src/fs/gnunet-fs-gtk_event-handler.h 2013-11-05 22:19:28 UTC
(rev 30549)
@@ -187,7 +187,20 @@
*/
struct SearchResult
{
+
/**
+ * If this search result has a manually-activated probe,
+ * we keep it in the 'pr_head' list.
+ */
+ struct SearchResult *next;
+
+ /**
+ * If this search result has a manually-activated probe,
+ * we keep it in the 'pr_head' list.
+ */
+ struct SearchResult *prev;
+
+ /**
* Where in the tab is this result?
*/
GtkTreeRowReference *rr;
@@ -218,6 +231,18 @@
/**
+ * Head of search results with a manually-activated probe.
+ */
+extern struct SearchResult *pl_head;
+
+/**
+ * Tail of search results with a manually-activated probe.
+ */
+extern struct SearchResult *pl_tail;
+
+
+
+/**
* Setup a new top-level entry in the URI/orphan tab. If necessary, create
* the URI tab first.
*
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r30549 - gnunet-gtk/src/fs,
gnunet <=