aboutsummaryrefslogtreecommitdiff
path: root/src/fs
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2011-05-27 17:25:30 +0000
committerChristian Grothoff <christian@grothoff.org>2011-05-27 17:25:30 +0000
commitc6657a13b9959d2ce6ba8f4d4178a63549ebbc4f (patch)
treea686675c06f8a49e00f8477733b98b506f444f3f /src/fs
parentb8edc262dae8adf7d616830466968ab8e3367a52 (diff)
downloadgnunet-c6657a13b9959d2ce6ba8f4d4178a63549ebbc4f.tar.gz
gnunet-c6657a13b9959d2ce6ba8f4d4178a63549ebbc4f.zip
make sure not to recursively call ntr
Diffstat (limited to 'src/fs')
-rw-r--r--src/fs/fs_test_lib_data.conf2
-rw-r--r--src/fs/gnunet-service-fs_cp.c34
-rw-r--r--src/fs/gnunet-service-fs_pr.c6
3 files changed, 33 insertions, 9 deletions
diff --git a/src/fs/fs_test_lib_data.conf b/src/fs/fs_test_lib_data.conf
index 00654c73d..731afa41c 100644
--- a/src/fs/fs_test_lib_data.conf
+++ b/src/fs/fs_test_lib_data.conf
@@ -66,8 +66,8 @@ HOSTKEYSFILE = ../../contrib/testing_hostkeys.dat
66 66
67[dhtcache] 67[dhtcache]
68QUOTA=65536 68QUOTA=65536
69
70DATABASE=sqlite 69DATABASE=sqlite
70
71[mesh] 71[mesh]
72AUTOSTART = NO 72AUTOSTART = NO
73 73
diff --git a/src/fs/gnunet-service-fs_cp.c b/src/fs/gnunet-service-fs_cp.c
index 2d8c879b8..8623e2b94 100644
--- a/src/fs/gnunet-service-fs_cp.c
+++ b/src/fs/gnunet-service-fs_cp.c
@@ -100,6 +100,14 @@ struct GSF_PeerTransmitHandle
100 size_t size; 100 size_t size;
101 101
102 /** 102 /**
103 * Set to 1 if we're currently in the process of calling
104 * 'GNUNET_CORE_notify_transmit_ready' (so while cth is
105 * NULL, we should not call notify_transmit_ready for this
106 * handle right now).
107 */
108 unsigned int cth_in_progress;
109
110 /**
103 * GNUNET_YES if this is a query, GNUNET_NO for content. 111 * GNUNET_YES if this is a query, GNUNET_NO for content.
104 */ 112 */
105 int is_query; 113 int is_query;
@@ -367,7 +375,8 @@ schedule_transmission (struct GSF_PeerTransmitHandle *pth)
367 struct GNUNET_PeerIdentity target; 375 struct GNUNET_PeerIdentity target;
368 uint64_t ip; 376 uint64_t ip;
369 377
370 if (NULL != pth->cth) 378 if ( (NULL != pth->cth) ||
379 (0 != pth->cth_in_progress) )
371 return; /* already done */ 380 return; /* already done */
372 cp = pth->cp; 381 cp = pth->cp;
373 GNUNET_PEER_resolve (cp->ppd.pid, 382 GNUNET_PEER_resolve (cp->ppd.pid,
@@ -392,6 +401,8 @@ schedule_transmission (struct GSF_PeerTransmitHandle *pth)
392 &core_reserve_callback, 401 &core_reserve_callback,
393 cp); 402 cp);
394 } 403 }
404 GNUNET_assert (pth->cth == NULL);
405 pth->cth_in_progress++;
395 pth->cth = GNUNET_CORE_notify_transmit_ready (GSF_core, 406 pth->cth = GNUNET_CORE_notify_transmit_ready (GSF_core,
396 GNUNET_YES, 407 GNUNET_YES,
397 pth->priority, 408 pth->priority,
@@ -400,6 +411,7 @@ schedule_transmission (struct GSF_PeerTransmitHandle *pth)
400 pth->size, 411 pth->size,
401 &peer_transmit_ready_cb, 412 &peer_transmit_ready_cb,
402 pth); 413 pth);
414 GNUNET_assert (0 < pth->cth_in_progress--);
403} 415}
404 416
405 417
@@ -420,7 +432,7 @@ peer_transmit_ready_cb (void *cls,
420 struct GSF_PeerTransmitHandle *pos; 432 struct GSF_PeerTransmitHandle *pos;
421 struct GSF_ConnectedPeer *cp; 433 struct GSF_ConnectedPeer *cp;
422 size_t ret; 434 size_t ret;
423 435
424 GNUNET_assert ( (NULL == buf) || 436 GNUNET_assert ( (NULL == buf) ||
425 (pth->size <= size) ); 437 (pth->size <= size) );
426 pth->cth = NULL; 438 pth->cth = NULL;
@@ -452,6 +464,8 @@ peer_transmit_ready_cb (void *cls,
452 GNUNET_assert (pos != pth); 464 GNUNET_assert (pos != pth);
453 schedule_transmission (pos); 465 schedule_transmission (pos);
454 } 466 }
467 GNUNET_assert (pth->cth == NULL);
468 GNUNET_assert (pth->cth_in_progress == 0);
455 GNUNET_free (pth); 469 GNUNET_free (pth);
456 return ret; 470 return ret;
457} 471}
@@ -524,6 +538,7 @@ core_reserve_callback (void *cls,
524 (NULL == pth->cth) ) 538 (NULL == pth->cth) )
525 { 539 {
526 /* reservation success, try transmission now! */ 540 /* reservation success, try transmission now! */
541 pth->cth_in_progress++;
527 pth->cth = GNUNET_CORE_notify_transmit_ready (GSF_core, 542 pth->cth = GNUNET_CORE_notify_transmit_ready (GSF_core,
528 GNUNET_YES, 543 GNUNET_YES,
529 pth->priority, 544 pth->priority,
@@ -532,6 +547,7 @@ core_reserve_callback (void *cls,
532 pth->size, 547 pth->size,
533 &peer_transmit_ready_cb, 548 &peer_transmit_ready_cb,
534 pth); 549 pth);
550 GNUNET_assert (0 < pth->cth_in_progress--);
535 } 551 }
536} 552}
537 553
@@ -823,6 +839,7 @@ handle_p2p_reply (void *cls,
823 pm); 839 pm);
824 if (eval != GNUNET_BLOCK_EVALUATION_OK_LAST) 840 if (eval != GNUNET_BLOCK_EVALUATION_OK_LAST)
825 return; 841 return;
842 GNUNET_assert (GNUNET_SCHEDULER_NO_TASK == peerreq->kill_task);
826 peerreq->kill_task = GNUNET_SCHEDULER_add_now (&peer_request_destroy, 843 peerreq->kill_task = GNUNET_SCHEDULER_add_now (&peer_request_destroy,
827 peerreq); 844 peerreq);
828} 845}
@@ -1167,7 +1184,10 @@ GSF_handle_p2p_query_ (const struct GNUNET_PeerIdentity *other,
1167 &gm->query, 1184 &gm->query,
1168 peerreq)); 1185 peerreq));
1169 if (peerreq->kill_task != GNUNET_SCHEDULER_NO_TASK) 1186 if (peerreq->kill_task != GNUNET_SCHEDULER_NO_TASK)
1170 GNUNET_SCHEDULER_cancel (peerreq->kill_task); 1187 {
1188 GNUNET_SCHEDULER_cancel (peerreq->kill_task);
1189 peerreq->kill_task = GNUNET_SCHEDULER_NO_TASK;
1190 }
1171 GNUNET_free (peerreq); 1191 GNUNET_free (peerreq);
1172 } 1192 }
1173 } 1193 }
@@ -1244,6 +1264,7 @@ peer_transmit_timeout (void *cls,
1244 } 1264 }
1245 pth->gmc (pth->gmc_cls, 1265 pth->gmc (pth->gmc_cls,
1246 0, NULL); 1266 0, NULL);
1267 GNUNET_assert (0 == pth->cth_in_progress);
1247 GNUNET_free (pth); 1268 GNUNET_free (pth);
1248} 1269}
1249 1270
@@ -1342,6 +1363,7 @@ GSF_peer_transmit_cancel_ (struct GSF_PeerTransmitHandle *pth)
1342 GNUNET_assert (0 < cp->ppd.pending_queries--); 1363 GNUNET_assert (0 < cp->ppd.pending_queries--);
1343 else if (GNUNET_NO == pth->is_query) 1364 else if (GNUNET_NO == pth->is_query)
1344 GNUNET_assert (0 < cp->ppd.pending_replies--); 1365 GNUNET_assert (0 < cp->ppd.pending_replies--);
1366 GNUNET_assert (0 == pth->cth_in_progress);
1345 GNUNET_free (pth); 1367 GNUNET_free (pth);
1346} 1368}
1347 1369
@@ -1444,7 +1466,10 @@ cancel_pending_request (void *cls,
1444 1466
1445 GSF_pending_request_cancel_ (pr); 1467 GSF_pending_request_cancel_ (pr);
1446 if (peerreq->kill_task != GNUNET_SCHEDULER_NO_TASK) 1468 if (peerreq->kill_task != GNUNET_SCHEDULER_NO_TASK)
1447 GNUNET_SCHEDULER_cancel (peerreq->kill_task); 1469 {
1470 GNUNET_SCHEDULER_cancel (peerreq->kill_task);
1471 peerreq->kill_task = GNUNET_SCHEDULER_NO_TASK;
1472 }
1448 GNUNET_free (peerreq); 1473 GNUNET_free (peerreq);
1449 return GNUNET_OK; 1474 return GNUNET_OK;
1450} 1475}
@@ -1510,6 +1535,7 @@ GSF_peer_disconnect_handler_ (void *cls,
1510 GNUNET_CONTAINER_DLL_remove (cp->pth_head, 1535 GNUNET_CONTAINER_DLL_remove (cp->pth_head,
1511 cp->pth_tail, 1536 cp->pth_tail,
1512 pth); 1537 pth);
1538 GNUNET_assert (0 == pth->cth_in_progress);
1513 GNUNET_free (pth); 1539 GNUNET_free (pth);
1514 } 1540 }
1515 GNUNET_PEER_change_rc (cp->ppd.pid, -1); 1541 GNUNET_PEER_change_rc (cp->ppd.pid, -1);
diff --git a/src/fs/gnunet-service-fs_pr.c b/src/fs/gnunet-service-fs_pr.c
index 74d2ad56e..1347f7789 100644
--- a/src/fs/gnunet-service-fs_pr.c
+++ b/src/fs/gnunet-service-fs_pr.c
@@ -1236,10 +1236,8 @@ process_local_reply (void *cls,
1236 GNUNET_TIME_UNIT_FOREVER_REL, 1236 GNUNET_TIME_UNIT_FOREVER_REL,
1237 &process_local_reply, 1237 &process_local_reply,
1238 pr); 1238 pr);
1239 if (pr->qe == NULL) 1239 if (pr->qe == NULL)
1240 { 1240 goto check_error_and_continue;
1241 goto check_error_and_continue;
1242 }
1243 return; 1241 return;
1244 } 1242 }
1245 prq.type = type; 1243 prq.type = type;