aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2010-05-14 15:35:57 +0000
committerChristian Grothoff <christian@grothoff.org>2010-05-14 15:35:57 +0000
commita1b9bb7410e9c41e0b96eb70a54f06cebdc42258 (patch)
tree4206fe48243bb8dce1cf41a5d61bc5b6302c2d30
parent4062de42eec444eeb6803ace0877d6e3c61ae3cd (diff)
downloadgnunet-a1b9bb7410e9c41e0b96eb70a54f06cebdc42258.tar.gz
gnunet-a1b9bb7410e9c41e0b96eb70a54f06cebdc42258.zip
fixes
-rw-r--r--src/fs/fs_publish.c49
-rw-r--r--src/fs/fs_test_lib_data.conf4
-rw-r--r--src/fs/gnunet-service-fs.c13
-rw-r--r--src/fs/test_fs_download.c12
-rw-r--r--src/fs/test_gnunet_service_fs_p2p.c2
5 files changed, 57 insertions, 23 deletions
diff --git a/src/fs/fs_publish.c b/src/fs/fs_publish.c
index 4e2039ba0..4d93579bd 100644
--- a/src/fs/fs_publish.c
+++ b/src/fs/fs_publish.c
@@ -117,6 +117,7 @@ publish_cleanup (void *cls,
117 const struct GNUNET_SCHEDULER_TaskContext *tc) 117 const struct GNUNET_SCHEDULER_TaskContext *tc)
118{ 118{
119 struct GNUNET_FS_PublishContext *pc = cls; 119 struct GNUNET_FS_PublishContext *pc = cls;
120
120 GNUNET_FS_file_information_destroy (pc->fi, NULL, NULL); 121 GNUNET_FS_file_information_destroy (pc->fi, NULL, NULL);
121 if (pc->namespace != NULL) 122 if (pc->namespace != NULL)
122 GNUNET_FS_namespace_delete (pc->namespace, GNUNET_NO); 123 GNUNET_FS_namespace_delete (pc->namespace, GNUNET_NO);
@@ -124,7 +125,10 @@ publish_cleanup (void *cls,
124 GNUNET_free_non_null (pc->nuid); 125 GNUNET_free_non_null (pc->nuid);
125 GNUNET_free_non_null (pc->serialization); 126 GNUNET_free_non_null (pc->serialization);
126 if (pc->dsh != NULL) 127 if (pc->dsh != NULL)
127 GNUNET_DATASTORE_disconnect (pc->dsh, GNUNET_NO); 128 {
129 GNUNET_DATASTORE_disconnect (pc->dsh, GNUNET_NO);
130 pc->dsh = NULL;
131 }
128 if (pc->client != NULL) 132 if (pc->client != NULL)
129 GNUNET_CLIENT_disconnect (pc->client, GNUNET_NO); 133 GNUNET_CLIENT_disconnect (pc->client, GNUNET_NO);
130 GNUNET_free (pc); 134 GNUNET_free (pc);
@@ -997,6 +1001,11 @@ fip_signal_suspend(void *cls,
997 pi.status = GNUNET_FS_STATUS_PUBLISH_SUSPEND; 1001 pi.status = GNUNET_FS_STATUS_PUBLISH_SUSPEND;
998 GNUNET_break (NULL == GNUNET_FS_publish_make_status_ (&pi, sc, fi, off)); 1002 GNUNET_break (NULL == GNUNET_FS_publish_make_status_ (&pi, sc, fi, off));
999 *client_info = NULL; 1003 *client_info = NULL;
1004 if (NULL != sc->dsh)
1005 {
1006 GNUNET_DATASTORE_disconnect (sc->dsh, GNUNET_NO);
1007 sc->dsh = NULL;
1008 }
1000 return GNUNET_OK; 1009 return GNUNET_OK;
1001} 1010}
1002 1011
@@ -1021,12 +1030,10 @@ GNUNET_FS_publish_signal_suspend_ (void *cls)
1021 &fip_signal_suspend, 1030 &fip_signal_suspend,
1022 pc); 1031 pc);
1023 GNUNET_FS_end_top (pc->h, pc->top); 1032 GNUNET_FS_end_top (pc->h, pc->top);
1024 GNUNET_SCHEDULER_add_continuation (pc->h->sched, 1033 publish_cleanup (pc, NULL);
1025 &publish_cleanup,
1026 pc,
1027 GNUNET_SCHEDULER_REASON_PREREQ_DONE);
1028} 1034}
1029 1035
1036
1030/** 1037/**
1031 * Publish a file or directory. 1038 * Publish a file or directory.
1032 * 1039 *
@@ -1152,6 +1159,11 @@ void
1152GNUNET_FS_publish_stop (struct GNUNET_FS_PublishContext *pc) 1159GNUNET_FS_publish_stop (struct GNUNET_FS_PublishContext *pc)
1153{ 1160{
1154 GNUNET_FS_end_top (pc->h, pc->top); 1161 GNUNET_FS_end_top (pc->h, pc->top);
1162 if (NULL != pc->dsh)
1163 {
1164 GNUNET_DATASTORE_disconnect (pc->dsh, GNUNET_NO);
1165 pc->dsh = NULL;
1166 }
1155 if (GNUNET_SCHEDULER_NO_TASK != pc->upload_task) 1167 if (GNUNET_SCHEDULER_NO_TASK != pc->upload_task)
1156 { 1168 {
1157 GNUNET_SCHEDULER_cancel (pc->h->sched, pc->upload_task); 1169 GNUNET_SCHEDULER_cancel (pc->h->sched, pc->upload_task);
@@ -1171,10 +1183,7 @@ GNUNET_FS_publish_stop (struct GNUNET_FS_PublishContext *pc)
1171 pc->in_network_wait = GNUNET_SYSERR; 1183 pc->in_network_wait = GNUNET_SYSERR;
1172 return; 1184 return;
1173 } 1185 }
1174 GNUNET_SCHEDULER_add_continuation (pc->h->sched, 1186 publish_cleanup (pc, NULL);
1175 &publish_cleanup,
1176 pc,
1177 GNUNET_SCHEDULER_REASON_PREREQ_DONE);
1178} 1187}
1179 1188
1180 1189
@@ -1285,7 +1294,11 @@ kb_put_cont (void *cls,
1285 1294
1286 if (GNUNET_OK != success) 1295 if (GNUNET_OK != success)
1287 { 1296 {
1288 GNUNET_DATASTORE_disconnect (pkc->dsh, GNUNET_NO); 1297 if (NULL != pkc->dsh)
1298 {
1299 GNUNET_DATASTORE_disconnect (pkc->dsh, GNUNET_NO);
1300 pkc->dsh = NULL;
1301 }
1289 GNUNET_free (pkc->cpy); 1302 GNUNET_free (pkc->cpy);
1290 GNUNET_free (pkc->kb); 1303 GNUNET_free (pkc->kb);
1291 pkc->cont (pkc->cont_cls, 1304 pkc->cont (pkc->cont_cls,
@@ -1326,7 +1339,10 @@ publish_ksk_cont (void *cls,
1326 (NULL == pkc->dsh) ) 1339 (NULL == pkc->dsh) )
1327 { 1340 {
1328 if (NULL != pkc->dsh) 1341 if (NULL != pkc->dsh)
1329 GNUNET_DATASTORE_disconnect (pkc->dsh, GNUNET_NO); 1342 {
1343 GNUNET_DATASTORE_disconnect (pkc->dsh, GNUNET_NO);
1344 pkc->dsh = NULL;
1345 }
1330 GNUNET_free (pkc->cpy); 1346 GNUNET_free (pkc->cpy);
1331 GNUNET_free (pkc->kb); 1347 GNUNET_free (pkc->kb);
1332 pkc->cont (pkc->cont_cls, 1348 pkc->cont (pkc->cont_cls,
@@ -1452,7 +1468,10 @@ GNUNET_FS_publish_ksk (struct GNUNET_FS_Handle *h,
1452 GNUNET_break (0); 1468 GNUNET_break (0);
1453 GNUNET_free (pkc->kb); 1469 GNUNET_free (pkc->kb);
1454 if (pkc->dsh != NULL) 1470 if (pkc->dsh != NULL)
1455 GNUNET_DATASTORE_disconnect (pkc->dsh, GNUNET_NO); 1471 {
1472 GNUNET_DATASTORE_disconnect (pkc->dsh, GNUNET_NO);
1473 pkc->dsh = NULL;
1474 }
1456 cont (cont_cls, NULL, _("Internal error.")); 1475 cont (cont_cls, NULL, _("Internal error."));
1457 GNUNET_free (pkc); 1476 GNUNET_free (pkc);
1458 return; 1477 return;
@@ -1518,7 +1537,10 @@ sb_put_cont (void *cls,
1518 struct PublishSksContext *psc = cls; 1537 struct PublishSksContext *psc = cls;
1519 1538
1520 if (NULL != psc->dsh) 1539 if (NULL != psc->dsh)
1521 GNUNET_DATASTORE_disconnect (psc->dsh, GNUNET_NO); 1540 {
1541 GNUNET_DATASTORE_disconnect (psc->dsh, GNUNET_NO);
1542 psc->dsh = NULL;
1543 }
1522 if (GNUNET_OK != success) 1544 if (GNUNET_OK != success)
1523 psc->cont (psc->cont_cls, 1545 psc->cont (psc->cont_cls,
1524 NULL, 1546 NULL,
@@ -1685,7 +1707,6 @@ GNUNET_FS_publish_sks (struct GNUNET_FS_Handle *h,
1685 GNUNET_CONSTANTS_SERVICE_TIMEOUT, 1707 GNUNET_CONSTANTS_SERVICE_TIMEOUT,
1686 &sb_put_cont, 1708 &sb_put_cont,
1687 psc); 1709 psc);
1688
1689 GNUNET_free (sb); 1710 GNUNET_free (sb);
1690 GNUNET_free (sb_enc); 1711 GNUNET_free (sb_enc);
1691} 1712}
diff --git a/src/fs/fs_test_lib_data.conf b/src/fs/fs_test_lib_data.conf
index d65bce262..e7fea5450 100644
--- a/src/fs/fs_test_lib_data.conf
+++ b/src/fs/fs_test_lib_data.conf
@@ -20,7 +20,7 @@ HOSTNAME = localhost
20DEFAULTSERVICES = 20DEFAULTSERVICES =
21 21
22[datastore] 22[datastore]
23#DEBUG = YES 23DEBUG = YES
24#PREFIX = valgrind --tool=memcheck --leak-check=yes 24#PREFIX = valgrind --tool=memcheck --leak-check=yes
25#BINARY = /home/grothoff/bin/gnunet-service-datastore 25#BINARY = /home/grothoff/bin/gnunet-service-datastore
26 26
@@ -52,7 +52,7 @@ TOTAL_QUOTA_OUT = 3932160
52PORT = 43471 52PORT = 43471
53HOSTNAME = localhost 53HOSTNAME = localhost
54#OPTIONS = -L DEBUG 54#OPTIONS = -L DEBUG
55# DEBUG = YES 55DEBUG = YES
56#PREFIX = valgrind --tool=memcheck --leak-check=yes 56#PREFIX = valgrind --tool=memcheck --leak-check=yes
57#BINARY = /home/grothoff/bin/gnunet-service-fs 57#BINARY = /home/grothoff/bin/gnunet-service-fs
58#PREFIX = xterm -e gdb -x cmd --args 58#PREFIX = xterm -e gdb -x cmd --args
diff --git a/src/fs/gnunet-service-fs.c b/src/fs/gnunet-service-fs.c
index e85d99cfd..124bab521 100644
--- a/src/fs/gnunet-service-fs.c
+++ b/src/fs/gnunet-service-fs.c
@@ -2270,6 +2270,7 @@ process_local_reply (void *cls,
2270 anonymity, expiration, uid, 2270 anonymity, expiration, uid,
2271 &process_local_reply, 2271 &process_local_reply,
2272 pr)) 2272 pr))
2273 if (pr->qe != NULL)
2273 GNUNET_DATASTORE_get_next (dsh, GNUNET_YES); 2274 GNUNET_DATASTORE_get_next (dsh, GNUNET_YES);
2274 return; 2275 return;
2275 } 2276 }
@@ -2291,7 +2292,8 @@ process_local_reply (void *cls,
2291 gettext_noop ("# results filtered by query bloomfilter"), 2292 gettext_noop ("# results filtered by query bloomfilter"),
2292 1, 2293 1,
2293 GNUNET_NO); 2294 GNUNET_NO);
2294 GNUNET_DATASTORE_get_next (dsh, GNUNET_YES); 2295 if (pr->qe != NULL)
2296 GNUNET_DATASTORE_get_next (dsh, GNUNET_YES);
2295 return; 2297 return;
2296 } 2298 }
2297#if DEBUG_FS 2299#if DEBUG_FS
@@ -2332,7 +2334,8 @@ process_local_reply (void *cls,
2332 if ( (type == GNUNET_BLOCK_TYPE_DBLOCK) || 2334 if ( (type == GNUNET_BLOCK_TYPE_DBLOCK) ||
2333 (type == GNUNET_BLOCK_TYPE_IBLOCK) ) 2335 (type == GNUNET_BLOCK_TYPE_IBLOCK) )
2334 { 2336 {
2335 GNUNET_DATASTORE_get_next (dsh, GNUNET_NO); 2337 if (pr->qe != NULL)
2338 GNUNET_DATASTORE_get_next (dsh, GNUNET_NO);
2336 return; 2339 return;
2337 } 2340 }
2338 if ( (pr->client_request_list == NULL) && 2341 if ( (pr->client_request_list == NULL) &&
@@ -2347,10 +2350,12 @@ process_local_reply (void *cls,
2347 gettext_noop ("# processing result set cut short due to load"), 2350 gettext_noop ("# processing result set cut short due to load"),
2348 1, 2351 1,
2349 GNUNET_NO); 2352 GNUNET_NO);
2350 GNUNET_DATASTORE_get_next (dsh, GNUNET_NO); 2353 if (pr->qe != NULL)
2354 GNUNET_DATASTORE_get_next (dsh, GNUNET_NO);
2351 return; 2355 return;
2352 } 2356 }
2353 GNUNET_DATASTORE_get_next (dsh, GNUNET_YES); 2357 if (pr->qe != NULL)
2358 GNUNET_DATASTORE_get_next (dsh, GNUNET_YES);
2354} 2359}
2355 2360
2356 2361
diff --git a/src/fs/test_fs_download.c b/src/fs/test_fs_download.c
index 068095269..fdd0452c2 100644
--- a/src/fs/test_fs_download.c
+++ b/src/fs/test_fs_download.c
@@ -103,6 +103,13 @@ abort_publish_task (void *cls,
103 } 103 }
104} 104}
105 105
106static void
107stop_fs_task (void *cls,
108 const struct GNUNET_SCHEDULER_TaskContext *tc)
109{
110 GNUNET_FS_stop (fs);
111 fs = NULL;
112}
106 113
107static void 114static void
108abort_download_task (void *cls, 115abort_download_task (void *cls,
@@ -207,8 +214,9 @@ progress_cb (void *cls,
207 GNUNET_assert (publish == event->value.publish.sc); 214 GNUNET_assert (publish == event->value.publish.sc);
208 GNUNET_assert (FILESIZE == event->value.publish.size); 215 GNUNET_assert (FILESIZE == event->value.publish.size);
209 GNUNET_assert (1 == event->value.publish.anonymity); 216 GNUNET_assert (1 == event->value.publish.anonymity);
210 GNUNET_FS_stop (fs); 217 GNUNET_SCHEDULER_add_now (sched,
211 fs = NULL; 218 &stop_fs_task,
219 NULL);
212 break; 220 break;
213 case GNUNET_FS_STATUS_DOWNLOAD_START: 221 case GNUNET_FS_STATUS_DOWNLOAD_START:
214 GNUNET_assert (download == NULL); 222 GNUNET_assert (download == NULL);
diff --git a/src/fs/test_gnunet_service_fs_p2p.c b/src/fs/test_gnunet_service_fs_p2p.c
index 7e3e02c76..92ac44dcc 100644
--- a/src/fs/test_gnunet_service_fs_p2p.c
+++ b/src/fs/test_gnunet_service_fs_p2p.c
@@ -26,7 +26,7 @@
26#include "platform.h" 26#include "platform.h"
27#include "fs_test_lib.h" 27#include "fs_test_lib.h"
28 28
29#define VERBOSE GNUNET_NO 29#define VERBOSE GNUNET_YES
30 30
31/** 31/**
32 * File-size we use for testing. 32 * File-size we use for testing.