aboutsummaryrefslogtreecommitdiff
path: root/src/fs
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2013-11-05 22:19:28 +0000
committerChristian Grothoff <christian@grothoff.org>2013-11-05 22:19:28 +0000
commit0b905185cd9d8f45a4c866ef2a413a66530d5a94 (patch)
treeb9d3dbbe07dc8d5f69f8a067ea83a72e26709a92 /src/fs
parent5047a37697a5a6e932f65dd3901908b253ead752 (diff)
downloadgnunet-gtk-0b905185cd9d8f45a4c866ef2a413a66530d5a94.tar.gz
gnunet-gtk-0b905185cd9d8f45a4c866ef2a413a66530d5a94.zip
-cancel manually started probes before stopping FS
Diffstat (limited to 'src/fs')
-rw-r--r--src/fs/gnunet-fs-gtk.c14
-rw-r--r--src/fs/gnunet-fs-gtk_event-handler.c32
-rw-r--r--src/fs/gnunet-fs-gtk_event-handler.h25
3 files changed, 69 insertions, 2 deletions
diff --git a/src/fs/gnunet-fs-gtk.c b/src/fs/gnunet-fs-gtk.c
index ea3397d8..d5974479 100644
--- a/src/fs/gnunet-fs-gtk.c
+++ b/src/fs/gnunet-fs-gtk.c
@@ -230,13 +230,23 @@ GNUNET_GTK_main_window_configure_event_cb (GtkWidget *main_window,
230 * @param tc scheduler context, unused 230 * @param tc scheduler context, unused
231 */ 231 */
232static void 232static void
233shutdown_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) 233shutdown_task (void *cls,
234 const struct GNUNET_SCHEDULER_TaskContext *tc)
234{ 235{
235 struct SearchLookup *sl; 236 struct SearchLookup *sl;
236 struct PseuLookupContext *lctx; 237 struct PseuLookupContext *lctx;
238 struct SearchResult *sr;
237 239
238 GNUNET_GTK_tray_icon_destroy (); 240 GNUNET_GTK_tray_icon_destroy ();
239 if (fs != NULL) 241 while (NULL != (sr = pl_head))
242 {
243 GNUNET_FS_probe_stop (sr->probe);
244 sr->probe = NULL;
245 GNUNET_CONTAINER_DLL_remove (pl_head,
246 pl_tail,
247 sr);
248 }
249 if (NULL != fs)
240 { 250 {
241 GNUNET_FS_stop (fs); 251 GNUNET_FS_stop (fs);
242 fs = NULL; 252 fs = NULL;
diff --git a/src/fs/gnunet-fs-gtk_event-handler.c b/src/fs/gnunet-fs-gtk_event-handler.c
index 52a12caa..ec1f60ad 100644
--- a/src/fs/gnunet-fs-gtk_event-handler.c
+++ b/src/fs/gnunet-fs-gtk_event-handler.c
@@ -246,6 +246,16 @@ struct PublishEntry
246 246
247 247
248/** 248/**
249 * Head of search results with a manually-activated probe.
250 */
251struct SearchResult *pl_head;
252
253/**
254 * Tail of search results with a manually-activated probe.
255 */
256struct SearchResult *pl_tail;
257
258/**
249 * Head of linked list of tabs for searches. 259 * Head of linked list of tabs for searches.
250 */ 260 */
251static struct SearchTab *search_tab_head; 261static struct SearchTab *search_tab_head;
@@ -1722,7 +1732,13 @@ move_downloads_in_subtree (GtkTreeModel *tm,
1722 GNUNET_CONTAINER_meta_data_destroy (meta); 1732 GNUNET_CONTAINER_meta_data_destroy (meta);
1723 gtk_tree_row_reference_free (sr->rr); 1733 gtk_tree_row_reference_free (sr->rr);
1724 if (NULL != sr->probe) 1734 if (NULL != sr->probe)
1735 {
1725 GNUNET_FS_probe_stop (sr->probe); 1736 GNUNET_FS_probe_stop (sr->probe);
1737 sr->probe = NULL;
1738 GNUNET_CONTAINER_DLL_remove (pl_head,
1739 pl_tail,
1740 sr);
1741 }
1726 GNUNET_free (sr); 1742 GNUNET_free (sr);
1727 /* get ready for removal of the tree */ 1743 /* get ready for removal of the tree */
1728 gtk_tree_store_set (GTK_TREE_STORE (tm), &child, 1744 gtk_tree_store_set (GTK_TREE_STORE (tm), &child,
@@ -1781,7 +1797,13 @@ free_search_result (struct SearchResult *sr)
1781 GNUNET_CONTAINER_meta_data_destroy (meta); 1797 GNUNET_CONTAINER_meta_data_destroy (meta);
1782 gtk_tree_row_reference_free (sr->rr); 1798 gtk_tree_row_reference_free (sr->rr);
1783 if (NULL != sr->probe) 1799 if (NULL != sr->probe)
1800 {
1784 GNUNET_FS_probe_stop (sr->probe); 1801 GNUNET_FS_probe_stop (sr->probe);
1802 sr->probe = NULL;
1803 GNUNET_CONTAINER_DLL_remove (pl_head,
1804 pl_tail,
1805 sr);
1806 }
1785 GNUNET_free (sr); 1807 GNUNET_free (sr);
1786 move_downloads_in_subtree (tm, &iter); 1808 move_downloads_in_subtree (tm, &iter);
1787 GNUNET_FS_GTK_remove_treestore_subtree (GTK_TREE_STORE (tm), &iter); 1809 GNUNET_FS_GTK_remove_treestore_subtree (GTK_TREE_STORE (tm), &iter);
@@ -2317,11 +2339,16 @@ GNUNET_GTK_add_search_result (struct SearchTab *tab,
2317 sr = GNUNET_new (struct SearchResult); 2339 sr = GNUNET_new (struct SearchResult);
2318 sr->result = result; 2340 sr->result = result;
2319 if (NULL == result) 2341 if (NULL == result)
2342 {
2320 sr->probe = GNUNET_FS_probe (GNUNET_FS_GTK_get_fs_handle (), 2343 sr->probe = GNUNET_FS_probe (GNUNET_FS_GTK_get_fs_handle (),
2321 uri, 2344 uri,
2322 meta, 2345 meta,
2323 sr, 2346 sr,
2324 anonymity); 2347 anonymity);
2348 GNUNET_CONTAINER_DLL_insert (pl_head,
2349 pl_tail,
2350 sr);
2351 }
2325 sr->tab = tab; 2352 sr->tab = tab;
2326 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 2353 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
2327 "Allocated a search result SR=%p\n", 2354 "Allocated a search result SR=%p\n",
@@ -3142,6 +3169,11 @@ setup_download (struct DownloadEntry *de, struct DownloadEntry *pde,
3142 download in the URI tab */ 3169 download in the URI tab */
3143 de->sr = GNUNET_GTK_add_to_uri_tab (anonymity, 3170 de->sr = GNUNET_GTK_add_to_uri_tab (anonymity,
3144 meta, uri); 3171 meta, uri);
3172 GNUNET_FS_probe_stop (de->sr->probe);
3173 de->sr->probe = NULL;
3174 GNUNET_CONTAINER_DLL_remove (pl_head,
3175 pl_tail,
3176 de->sr);
3145 de->sr->download = de; 3177 de->sr->download = de;
3146 path = gtk_tree_row_reference_get_path (de->sr->rr); 3178 path = gtk_tree_row_reference_get_path (de->sr->rr);
3147 if (! gtk_tree_model_get_iter (GTK_TREE_MODEL (de->sr->tab->ts), &iter, path)) 3179 if (! gtk_tree_model_get_iter (GTK_TREE_MODEL (de->sr->tab->ts), &iter, path))
diff --git a/src/fs/gnunet-fs-gtk_event-handler.h b/src/fs/gnunet-fs-gtk_event-handler.h
index e0f5d8ed..03a313e3 100644
--- a/src/fs/gnunet-fs-gtk_event-handler.h
+++ b/src/fs/gnunet-fs-gtk_event-handler.h
@@ -187,6 +187,19 @@ struct DownloadEntry
187 */ 187 */
188struct SearchResult 188struct SearchResult
189{ 189{
190
191 /**
192 * If this search result has a manually-activated probe,
193 * we keep it in the 'pr_head' list.
194 */
195 struct SearchResult *next;
196
197 /**
198 * If this search result has a manually-activated probe,
199 * we keep it in the 'pr_head' list.
200 */
201 struct SearchResult *prev;
202
190 /** 203 /**
191 * Where in the tab is this result? 204 * Where in the tab is this result?
192 */ 205 */
@@ -218,6 +231,18 @@ struct SearchResult
218 231
219 232
220/** 233/**
234 * Head of search results with a manually-activated probe.
235 */
236extern struct SearchResult *pl_head;
237
238/**
239 * Tail of search results with a manually-activated probe.
240 */
241extern struct SearchResult *pl_tail;
242
243
244
245/**
221 * Setup a new top-level entry in the URI/orphan tab. If necessary, create 246 * Setup a new top-level entry in the URI/orphan tab. If necessary, create
222 * the URI tab first. 247 * the URI tab first.
223 * 248 *