aboutsummaryrefslogtreecommitdiff
path: root/src/peerstore
diff options
context:
space:
mode:
Diffstat (limited to 'src/peerstore')
-rw-r--r--src/peerstore/peerstore_api.c53
-rw-r--r--src/peerstore/test_peerstore_api_iterate.c5
-rw-r--r--src/peerstore/test_peerstore_api_store.c6
-rw-r--r--src/peerstore/test_peerstore_api_sync.c4
4 files changed, 5 insertions, 63 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 {
diff --git a/src/peerstore/test_peerstore_api_iterate.c b/src/peerstore/test_peerstore_api_iterate.c
index 25b193372..3b01f312d 100644
--- a/src/peerstore/test_peerstore_api_iterate.c
+++ b/src/peerstore/test_peerstore_api_iterate.c
@@ -82,7 +82,6 @@ iter2_cb (void *cls,
82 ss, 82 ss,
83 NULL, 83 NULL,
84 NULL, 84 NULL,
85 GNUNET_TIME_UNIT_FOREVER_REL,
86 &iter3_cb, 85 &iter3_cb,
87 NULL); 86 NULL);
88} 87}
@@ -109,8 +108,7 @@ iter1_cb (void *cls,
109 ss, 108 ss,
110 &p1, 109 &p1,
111 NULL, 110 NULL,
112 GNUNET_TIME_UNIT_FOREVER_REL, 111 &iter2_cb,
113 iter2_cb,
114 NULL); 112 NULL);
115} 113}
116 114
@@ -158,7 +156,6 @@ run (void *cls,
158 ss, 156 ss,
159 &p1, 157 &p1,
160 k1, 158 k1,
161 GNUNET_TIME_UNIT_FOREVER_REL,
162 &iter1_cb, NULL); 159 &iter1_cb, NULL);
163} 160}
164 161
diff --git a/src/peerstore/test_peerstore_api_store.c b/src/peerstore/test_peerstore_api_store.c
index 194b96104..c3c03efc9 100644
--- a/src/peerstore/test_peerstore_api_store.c
+++ b/src/peerstore/test_peerstore_api_store.c
@@ -71,7 +71,6 @@ test3_cont (void *cls,
71 subsystem, 71 subsystem,
72 &pid, 72 &pid,
73 key, 73 key,
74 GNUNET_TIME_UNIT_SECONDS,
75 &test3_cont2, 74 &test3_cont2,
76 NULL); 75 NULL);
77} 76}
@@ -127,8 +126,8 @@ test2_cont (void *cls, int success)
127 GNUNET_PEERSTORE_iterate (h, 126 GNUNET_PEERSTORE_iterate (h,
128 subsystem, 127 subsystem,
129 &pid, key, 128 &pid, key,
130 GNUNET_TIME_UNIT_SECONDS, 129 &test2_cont2,
131 &test2_cont2, NULL); 130 NULL);
132} 131}
133 132
134 133
@@ -181,7 +180,6 @@ test1_cont (void *cls, int success)
181 subsystem, 180 subsystem,
182 &pid, 181 &pid,
183 key, 182 key,
184 GNUNET_TIME_UNIT_SECONDS,
185 &test1_cont2, 183 &test1_cont2,
186 NULL); 184 NULL);
187} 185}
diff --git a/src/peerstore/test_peerstore_api_sync.c b/src/peerstore/test_peerstore_api_sync.c
index 2b5361dea..15d8572ac 100644
--- a/src/peerstore/test_peerstore_api_sync.c
+++ b/src/peerstore/test_peerstore_api_sync.c
@@ -111,8 +111,8 @@ test_cont (void *cls)
111 GNUNET_PEERSTORE_iterate (h, 111 GNUNET_PEERSTORE_iterate (h,
112 subsystem, 112 subsystem,
113 &pid, key, 113 &pid, key,
114 GNUNET_TIME_UNIT_FOREVER_REL, 114 &iterate_cb,
115 &iterate_cb, NULL); 115 NULL);
116} 116}
117 117
118 118