aboutsummaryrefslogtreecommitdiff
path: root/src/peerstore/peerstore_api.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/peerstore/peerstore_api.c')
-rw-r--r--src/peerstore/peerstore_api.c53
1 files changed, 0 insertions, 53 deletions
diff --git a/src/peerstore/peerstore_api.c b/src/peerstore/peerstore_api.c
index 33a46a91a..892bc1679 100644
--- a/src/peerstore/peerstore_api.c
+++ b/src/peerstore/peerstore_api.c
@@ -183,11 +183,6 @@ struct GNUNET_PEERSTORE_IterateContext
183 char *key; 183 char *key;
184 184
185 /** 185 /**
186 * Operation timeout
187 */
188 struct GNUNET_TIME_Relative timeout;
189
190 /**
191 * Callback with each matching record 186 * Callback with each matching record
192 */ 187 */
193 GNUNET_PEERSTORE_Processor callback; 188 GNUNET_PEERSTORE_Processor callback;
@@ -202,12 +197,6 @@ struct GNUNET_PEERSTORE_IterateContext
202 */ 197 */
203 int iterating; 198 int iterating;
204 199
205 /**
206 * Task identifier for the function called
207 * on iterate request timeout
208 */
209 struct GNUNET_SCHEDULER_Task *timeout_task;
210
211}; 200};
212 201
213/** 202/**
@@ -327,29 +316,6 @@ rewatch_it (void *cls,
327 316
328 317
329/** 318/**
330 * Called when the iterate request is timedout
331 *
332 * @param cls a `struct GNUNET_PEERSTORE_IterateContext *`
333 */
334static void
335iterate_timeout (void *cls)
336{
337 struct GNUNET_PEERSTORE_IterateContext *ic = cls;
338 GNUNET_PEERSTORE_Processor callback;
339 void *callback_cls;
340
341 ic->timeout_task = NULL;
342 callback = ic->callback;
343 callback_cls = ic->callback_cls;
344 GNUNET_PEERSTORE_iterate_cancel (ic);
345 if (NULL != callback)
346 callback (callback_cls,
347 NULL,
348 _("timeout"));
349}
350
351
352/**
353 * Iterator over watch requests to cancel them. 319 * Iterator over watch requests to cancel them.
354 * 320 *
355 * @param cls unsused 321 * @param cls unsused
@@ -645,11 +611,6 @@ handle_iterate_result (void *cls,
645void 611void
646GNUNET_PEERSTORE_iterate_cancel (struct GNUNET_PEERSTORE_IterateContext *ic) 612GNUNET_PEERSTORE_iterate_cancel (struct GNUNET_PEERSTORE_IterateContext *ic)
647{ 613{
648 if (NULL != ic->timeout_task)
649 {
650 GNUNET_SCHEDULER_cancel (ic->timeout_task);
651 ic->timeout_task = NULL;
652 }
653 if (GNUNET_NO == ic->iterating) 614 if (GNUNET_NO == ic->iterating)
654 { 615 {
655 GNUNET_CONTAINER_DLL_remove (ic->h->iterate_head, 616 GNUNET_CONTAINER_DLL_remove (ic->h->iterate_head,
@@ -671,7 +632,6 @@ GNUNET_PEERSTORE_iterate_cancel (struct GNUNET_PEERSTORE_IterateContext *ic)
671 * @param sub_system name of sub system 632 * @param sub_system name of sub system
672 * @param peer Peer identity (can be NULL) 633 * @param peer Peer identity (can be NULL)
673 * @param key entry key string (can be NULL) 634 * @param key entry key string (can be NULL)
674 * @param timeout time after which the iterate request is canceled
675 * @param callback function called with each matching record, all NULL's on end 635 * @param callback function called with each matching record, all NULL's on end
676 * @param callback_cls closure for @a callback 636 * @param callback_cls closure for @a callback
677 * @return Handle to iteration request 637 * @return Handle to iteration request
@@ -681,7 +641,6 @@ GNUNET_PEERSTORE_iterate (struct GNUNET_PEERSTORE_Handle *h,
681 const char *sub_system, 641 const char *sub_system,
682 const struct GNUNET_PeerIdentity *peer, 642 const struct GNUNET_PeerIdentity *peer,
683 const char *key, 643 const char *key,
684 struct GNUNET_TIME_Relative timeout,
685 GNUNET_PEERSTORE_Processor callback, 644 GNUNET_PEERSTORE_Processor callback,
686 void *callback_cls) 645 void *callback_cls)
687{ 646{
@@ -696,7 +655,6 @@ GNUNET_PEERSTORE_iterate (struct GNUNET_PEERSTORE_Handle *h,
696 0, 655 0,
697 GNUNET_MESSAGE_TYPE_PEERSTORE_ITERATE); 656 GNUNET_MESSAGE_TYPE_PEERSTORE_ITERATE);
698 ic = GNUNET_new (struct GNUNET_PEERSTORE_IterateContext); 657 ic = GNUNET_new (struct GNUNET_PEERSTORE_IterateContext);
699
700 ic->callback = callback; 658 ic->callback = callback;
701 ic->callback_cls = callback_cls; 659 ic->callback_cls = callback_cls;
702 ic->h = h; 660 ic->h = h;
@@ -705,7 +663,6 @@ GNUNET_PEERSTORE_iterate (struct GNUNET_PEERSTORE_Handle *h,
705 ic->peer = *peer; 663 ic->peer = *peer;
706 if (NULL != key) 664 if (NULL != key)
707 ic->key = GNUNET_strdup (key); 665 ic->key = GNUNET_strdup (key);
708 ic->timeout = timeout;
709 GNUNET_CONTAINER_DLL_insert_tail (h->iterate_head, 666 GNUNET_CONTAINER_DLL_insert_tail (h->iterate_head,
710 h->iterate_tail, 667 h->iterate_tail,
711 ic); 668 ic);
@@ -713,10 +670,6 @@ GNUNET_PEERSTORE_iterate (struct GNUNET_PEERSTORE_Handle *h,
713 "Sending an iterate request for sub system `%s'\n", 670 "Sending an iterate request for sub system `%s'\n",
714 sub_system); 671 sub_system);
715 GNUNET_MQ_send (h->mq, ev); 672 GNUNET_MQ_send (h->mq, ev);
716 ic->timeout_task =
717 GNUNET_SCHEDULER_add_delayed (timeout,
718 &iterate_timeout,
719 ic);
720 return ic; 673 return ic;
721} 674}
722 675
@@ -860,12 +813,6 @@ reconnect (struct GNUNET_PEERSTORE_Handle *h)
860 0, 813 0,
861 GNUNET_MESSAGE_TYPE_PEERSTORE_ITERATE); 814 GNUNET_MESSAGE_TYPE_PEERSTORE_ITERATE);
862 GNUNET_MQ_send (h->mq, ev); 815 GNUNET_MQ_send (h->mq, ev);
863 if (NULL != ic->timeout_task)
864 GNUNET_SCHEDULER_cancel (ic->timeout_task);
865 ic->timeout_task
866 = GNUNET_SCHEDULER_add_delayed (ic->timeout,
867 &iterate_timeout,
868 ic);
869 } 816 }
870 for (sc = h->store_head; NULL != sc; sc = sc->next) 817 for (sc = h->store_head; NULL != sc; sc = sc->next)
871 { 818 {