aboutsummaryrefslogtreecommitdiff
path: root/src/fs/fs_search.c
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2010-05-03 21:35:44 +0000
committerChristian Grothoff <christian@grothoff.org>2010-05-03 21:35:44 +0000
commit7eb4b4b3ab14ef6433b08cca8c673d00f8405062 (patch)
tree04dfe48fe96a0a8096239b0083f19602b333a998 /src/fs/fs_search.c
parent4092583a7dcb0844d5957909ef81f6766b3f2603 (diff)
downloadgnunet-7eb4b4b3ab14ef6433b08cca8c673d00f8405062.tar.gz
gnunet-7eb4b4b3ab14ef6433b08cca8c673d00f8405062.zip
towards suspend
Diffstat (limited to 'src/fs/fs_search.c')
-rw-r--r--src/fs/fs_search.c23
1 files changed, 22 insertions, 1 deletions
diff --git a/src/fs/fs_search.c b/src/fs/fs_search.c
index 611a089c4..00909ce97 100644
--- a/src/fs/fs_search.c
+++ b/src/fs/fs_search.c
@@ -1161,6 +1161,21 @@ GNUNET_FS_search_start_searching_ (struct GNUNET_FS_SearchContext *sc)
1161} 1161}
1162 1162
1163 1163
1164/**
1165 * Create SUSPEND event for the given search operation
1166 * and then clean up our state (without stop signal).
1167 *
1168 * @param cls the 'struct GNUNET_FS_SearchContext' to signal for
1169 */
1170static void
1171search_signal_suspend (void *cls)
1172{
1173 struct GNUNET_FS_SearchContext *sc = cls;
1174
1175 GNUNET_FS_end_top (sc->h, sc->top);
1176 /* FIXME: signal! */
1177 GNUNET_free (sc);
1178}
1164 1179
1165 1180
1166/** 1181/**
@@ -1181,7 +1196,10 @@ GNUNET_FS_search_start (struct GNUNET_FS_Handle *h,
1181 enum GNUNET_FS_SearchOptions options, 1196 enum GNUNET_FS_SearchOptions options,
1182 void *cctx) 1197 void *cctx)
1183{ 1198{
1184 return search_start (h, uri, anonymity, options, cctx, NULL); 1199 struct GNUNET_FS_SearchContext *ret;
1200 ret = search_start (h, uri, anonymity, options, cctx, NULL);
1201 ret->top = GNUNET_FS_make_top (h, &search_signal_suspend, ret);
1202 return ret;
1185} 1203}
1186 1204
1187 1205
@@ -1253,6 +1271,7 @@ search_result_free (void *cls,
1253 pi.status = GNUNET_FS_STATUS_DOWNLOAD_LOST_PARENT; 1271 pi.status = GNUNET_FS_STATUS_DOWNLOAD_LOST_PARENT;
1254 GNUNET_FS_download_make_status_ (&pi, 1272 GNUNET_FS_download_make_status_ (&pi,
1255 sr->download); 1273 sr->download);
1274 /* FIXME: promote download to top-level! */
1256 sr->download = NULL; 1275 sr->download = NULL;
1257 } 1276 }
1258 pi.status = GNUNET_FS_STATUS_SEARCH_RESULT_STOPPED; 1277 pi.status = GNUNET_FS_STATUS_SEARCH_RESULT_STOPPED;
@@ -1298,6 +1317,8 @@ GNUNET_FS_search_stop (struct GNUNET_FS_SearchContext *sc)
1298 unsigned int i; 1317 unsigned int i;
1299 struct GNUNET_FS_SearchContext *parent; 1318 struct GNUNET_FS_SearchContext *parent;
1300 1319
1320 if (sc->top != NULL)
1321 GNUNET_FS_end_top (sc->h, sc->top);
1301 // FIXME: make un-persistent! 1322 // FIXME: make un-persistent!
1302 if (NULL != (parent = sc->parent)) 1323 if (NULL != (parent = sc->parent))
1303 { 1324 {