2 This file is part of GNUnet.
5 GNUnet is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published
7 by the Free Software Foundation; either version 3, or (at your
8 option) any later version.
10 GNUnet is distributed in the hope that it will be useful, but
11 WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 General Public License for more details.
15 You should have received a copy of the GNU General Public License
16 along with GNUnet; see the file COPYING. If not, write to the
17 Free Software Foundation, Inc., 59 Temple Place - Suite 330,
18 Boston, MA 02111-1307, USA.
22 * @file rps/gnunet-service-rps_sampler.c
23 * @brief sampler implementation
24 * @author Julius Bünger
27 #include "gnunet_util_lib.h"
30 #include "gnunet-service-rps_sampler.h"
35 #define LOG(kind, ...) GNUNET_log_from(kind,"rps-sampler",__VA_ARGS__)
37 // multiple 'clients'?
39 // TODO check for overflows
41 // TODO align message structs
43 // hist_size_init, hist_size_max
45 /***********************************************************************
46 * WARNING: This section needs to be reviewed regarding the use of
47 * functions providing (pseudo)randomness!
48 ***********************************************************************/
50 // TODO care about invalid input of the caller (size 0 or less...)
59 * A sampler element sampling one PeerID at a time.
61 struct RPS_SamplerElement
64 * Min-wise linear permutation used by this sampler.
66 * This is an key later used by a hmac.
68 struct GNUNET_CRYPTO_AuthKey auth_key;
71 * The PeerID this sampler currently samples.
73 struct GNUNET_PeerIdentity peer_id;
76 * The according hash value of this PeerID.
78 struct GNUNET_HashCode peer_id_hash;
82 * Time of last request.
84 struct GNUNET_TIME_Absolute last_client_request;
87 * Flag that indicates that we are not holding a valid PeerID right now.
89 enum RPS_SamplerEmpty is_empty;
94 struct GNUNET_TIME_Absolute birth;
97 * How many times a PeerID was put in this sampler.
102 * How many times this sampler changed the peer_id.
107 * The file name this sampler element should log to
116 * Sampler with its own array of SamplerElements
121 * Number of sampler elements we hold.
123 unsigned int sampler_size;
127 * All Samplers in one array.
129 struct RPS_SamplerElement **sampler_elements;
132 * Max time a round takes
134 * Used in the context of RPS
136 struct GNUNET_TIME_Relative max_round_interval;
140 * File name to log to
147 * Closure to _get_n_rand_peers_ready_cb()
149 struct NRandPeersReadyCls
152 * Number of peers we are waiting for.
157 * Number of peers we currently have.
159 uint32_t cur_num_peers;
162 * Pointer to the array holding the ids.
164 struct GNUNET_PeerIdentity *ids;
167 * Callback to be called when all ids are available.
169 RPS_sampler_n_rand_peers_ready_cb callback;
172 * Closure given to the callback
178 * Callback that is called from _get_rand_peer() when the PeerID is ready.
180 * @param cls the closure given alongside this function.
181 * @param id the PeerID that was returned
184 (*RPS_sampler_rand_peer_ready_cont) (void *cls,
185 const struct GNUNET_PeerIdentity *id);
188 * Closure for #sampler_get_rand_peer()
195 struct GetPeerCls *next;
200 struct GetPeerCls *prev;
203 * The sampler this function operates on.
205 struct RPS_Sampler *sampler;
208 * The task for this function.
210 struct GNUNET_SCHEDULER_Task *get_peer_task;
215 RPS_sampler_rand_peer_ready_cont cont;
218 * The closure to the callback @e cont
223 * The address of the id to be stored at
225 struct GNUNET_PeerIdentity *id;
230 // * Global sampler variable.
232 //struct RPS_Sampler *sampler;
236 * The minimal size for the extended sampler elements.
238 static size_t min_size;
241 * The maximal size the extended sampler elements should grow to.
243 static size_t max_size;
246 * The size the extended sampler elements currently have.
248 //static size_t extra_size;
251 * Inedex to the sampler element that is the next to be returned
253 static uint32_t client_get_index;
258 * This function is used to facilitate writing important information to disk
260 #define to_file(file_name, ...) do {char tmp_buf[512];\
262 size = GNUNET_snprintf(tmp_buf,sizeof(tmp_buf),__VA_ARGS__);\
264 LOG (GNUNET_ERROR_TYPE_WARNING,\
265 "Failed to create tmp_buf\n");\
267 to_file_(file_name,tmp_buf);\
271 to_file_ (char *file_name, char *line)
273 struct GNUNET_DISK_FileHandle *f;
274 char output_buffer[512];
280 if (NULL == (f = GNUNET_DISK_file_open (file_name,
281 GNUNET_DISK_OPEN_APPEND |
282 GNUNET_DISK_OPEN_WRITE |
283 GNUNET_DISK_OPEN_CREATE,
284 GNUNET_DISK_PERM_USER_WRITE)))
286 LOG (GNUNET_ERROR_TYPE_WARNING,
287 "Not able to open file %s\n",
291 size = GNUNET_snprintf (output_buffer,
292 sizeof (output_buffer),
294 GNUNET_TIME_absolute_get ().abs_value_us,
298 LOG (GNUNET_ERROR_TYPE_WARNING,
299 "Failed to write string to buffer (size: %i)\n",
304 size2 = GNUNET_DISK_file_write (f, output_buffer, size);
307 LOG (GNUNET_ERROR_TYPE_WARNING,
308 "Unable to write to file! (Size: %u, size2: %u)\n",
314 if (GNUNET_YES != GNUNET_DISK_file_close (f))
315 LOG (GNUNET_ERROR_TYPE_WARNING,
316 "Unable to close file\n");
321 /** FIXME document */
322 static struct GetPeerCls *gpc_head;
323 static struct GetPeerCls *gpc_tail;
327 * Callback to _get_rand_peer() used by _get_n_rand_peers().
329 * Checks whether all n peers are available. If they are,
333 check_n_peers_ready (void *cls,
334 const struct GNUNET_PeerIdentity *id)
336 struct NRandPeersReadyCls *n_peers_cls = cls;
338 n_peers_cls->cur_num_peers++;
339 LOG (GNUNET_ERROR_TYPE_DEBUG,
340 "Got %" PRIX32 ". of %" PRIX32 " peers\n",
341 n_peers_cls->cur_num_peers, n_peers_cls->num_peers);
343 if (n_peers_cls->num_peers == n_peers_cls->cur_num_peers)
344 { /* All peers are ready -- return those to the client */
345 GNUNET_assert (NULL != n_peers_cls->callback);
347 LOG (GNUNET_ERROR_TYPE_DEBUG,
348 "returning %" PRIX32 " peers to the client\n",
349 n_peers_cls->num_peers);
350 n_peers_cls->callback (n_peers_cls->cls, n_peers_cls->ids, n_peers_cls->num_peers);
352 GNUNET_free (n_peers_cls);
358 * Reinitialise a previously initialised sampler element.
360 * @param sampler pointer to the memory that keeps the value.
363 RPS_sampler_elem_reinit (struct RPS_SamplerElement *sampler_el)
365 sampler_el->is_empty = EMPTY;
367 // I guess I don't need to call GNUNET_CRYPTO_hmac_derive_key()...
368 GNUNET_CRYPTO_random_block(GNUNET_CRYPTO_QUALITY_STRONG,
369 &(sampler_el->auth_key.key),
370 GNUNET_CRYPTO_HASH_LENGTH);
373 /* Create a file(-name) to store internals to */
378 size_t keylen = (sizeof (struct GNUNET_CRYPTO_AuthKey)) * 8;
381 keylen += 5 - keylen % 5;
383 buf = GNUNET_malloc (keylen + 1);
385 end = GNUNET_STRINGS_data_to_string (&(sampler_el->auth_key.key),
386 sizeof (struct GNUNET_CRYPTO_AuthKey),
400 size = GNUNET_snprintf (name_buf, sizeof (name_buf), "sampler_el-%s-", buf);
402 LOG (GNUNET_ERROR_TYPE_WARNING, "Failed to create name_buf\n");
404 if (NULL == (sampler_el->file_name = GNUNET_DISK_mktemp (name_buf)))
405 LOG (GNUNET_ERROR_TYPE_WARNING, "Could not create file\n");
408 sampler_el->last_client_request = GNUNET_TIME_UNIT_FOREVER_ABS;
410 sampler_el->birth = GNUNET_TIME_absolute_get ();
411 sampler_el->num_peers = 0;
412 sampler_el->num_change = 0;
417 * (Re)Initialise given Sampler with random min-wise independent function.
419 * In this implementation this means choosing an auth_key for later use in
422 * @return a newly created RPS_SamplerElement which currently holds no id.
424 struct RPS_SamplerElement *
425 RPS_sampler_elem_create (void)
427 struct RPS_SamplerElement *s;
429 s = GNUNET_new (struct RPS_SamplerElement);
431 RPS_sampler_elem_reinit (s);
438 * Input an PeerID into the given sampler element.
440 * @param sampler the sampler the @a s_elem belongs to.
444 RPS_sampler_elem_next (struct RPS_SamplerElement *s_elem,
445 struct RPS_Sampler *sampler,
446 const struct GNUNET_PeerIdentity *other)
448 struct GNUNET_HashCode other_hash;
453 to_file (s_elem->file_name,
455 GNUNET_i2s_full (other));
458 if (0 == GNUNET_CRYPTO_cmp_peer_identity (other, &(s_elem->peer_id)))
460 LOG (GNUNET_ERROR_TYPE_DEBUG, " Got PeerID %s\n",
462 LOG (GNUNET_ERROR_TYPE_DEBUG, "Have already PeerID %s\n",
463 GNUNET_i2s (&(s_elem->peer_id)));
467 GNUNET_CRYPTO_hmac(&s_elem->auth_key,
469 sizeof(struct GNUNET_PeerIdentity),
472 if (EMPTY == s_elem->is_empty)
474 LOG (GNUNET_ERROR_TYPE_DEBUG,
475 "Got PeerID %s; Simply accepting (was empty previously).\n",
477 s_elem->peer_id = *other;
478 s_elem->peer_id_hash = other_hash;
480 s_elem->num_change++;
482 else if (0 > GNUNET_CRYPTO_hash_cmp (&other_hash, &s_elem->peer_id_hash))
484 LOG (GNUNET_ERROR_TYPE_DEBUG, " Got PeerID %s\n",
486 LOG (GNUNET_ERROR_TYPE_DEBUG, "Discarding old PeerID %s\n",
487 GNUNET_i2s (&s_elem->peer_id));
488 s_elem->peer_id = *other;
489 s_elem->peer_id_hash = other_hash;
491 s_elem->num_change++;
495 LOG (GNUNET_ERROR_TYPE_DEBUG, " Got PeerID %s\n",
497 LOG (GNUNET_ERROR_TYPE_DEBUG, "Keeping old PeerID %s\n",
498 GNUNET_i2s (&s_elem->peer_id));
501 s_elem->is_empty = NOT_EMPTY;
503 to_file (s_elem->file_name,
505 GNUNET_i2s_full (&s_elem->peer_id));
511 * Get the size of the sampler.
513 * @param sampler the sampler to return the size of.
514 * @return the size of the sampler
517 RPS_sampler_get_size (struct RPS_Sampler *sampler)
519 return sampler->sampler_size;
524 * Grow or shrink the size of the sampler.
526 * @param sampler the sampler to resize.
527 * @param new_size the new size of the sampler
530 sampler_resize (struct RPS_Sampler *sampler, unsigned int new_size)
532 unsigned int old_size;
535 // TODO check min and max size
537 old_size = sampler->sampler_size;
539 if (old_size > new_size)
541 /* Temporary store those to properly call the removeCB on those later */
543 LOG (GNUNET_ERROR_TYPE_DEBUG,
544 "Shrinking sampler %d -> %d\n",
548 to_file (sampler->file_name,
549 "Shrinking sampler %d -> %d",
553 for (i = new_size ; i < old_size ; i++)
555 to_file (sampler->file_name,
558 sampler->sampler_elements[i]->file_name);
561 GNUNET_array_grow (sampler->sampler_elements,
562 sampler->sampler_size,
564 LOG (GNUNET_ERROR_TYPE_DEBUG,
565 "sampler->sampler_elements now points to %p\n",
566 sampler->sampler_elements);
569 else if (old_size < new_size)
571 LOG (GNUNET_ERROR_TYPE_DEBUG,
572 "Growing sampler %d -> %d\n",
576 to_file (sampler->file_name,
577 "Growing sampler %d -> %d",
581 GNUNET_array_grow (sampler->sampler_elements,
582 sampler->sampler_size,
585 for (i = old_size ; i < new_size ; i++)
586 { /* Add new sampler elements */
587 sampler->sampler_elements[i] = RPS_sampler_elem_create ();
589 to_file (sampler->file_name,
592 sampler->sampler_elements[i]->file_name);
598 LOG (GNUNET_ERROR_TYPE_DEBUG, "Size remains the same -- nothing to do\n");
602 GNUNET_assert (sampler->sampler_size == new_size);
607 * Grow or shrink the size of the sampler.
609 * @param sampler the sampler to resize.
610 * @param new_size the new size of the sampler
613 RPS_sampler_resize (struct RPS_Sampler *sampler, unsigned int new_size)
615 GNUNET_assert (0 < new_size);
616 sampler_resize (sampler, new_size);
623 * @param sampler the sampler to empty.
624 * @param new_size the new size of the sampler
627 sampler_empty (struct RPS_Sampler *sampler)
629 sampler_resize (sampler, 0);
634 * Initialise a tuple of sampler elements.
636 * @param init_size the size the sampler is initialised with
637 * @param ins_cb the callback that will be called on every PeerID that is
638 * newly inserted into a sampler element
639 * @param ins_cls the closure given to #ins_cb
640 * @param rem_cb the callback that will be called on every PeerID that is
641 * removed from a sampler element
642 * @param rem_cls the closure given to #rem_cb
643 * @return a handle to a sampler that consists of sampler elements.
646 RPS_sampler_init (size_t init_size,
647 struct GNUNET_TIME_Relative max_round_interval)
649 struct RPS_Sampler *sampler;
652 /* Initialise context around extended sampler */
653 min_size = 10; // TODO make input to _samplers_init()
654 max_size = 1000; // TODO make input to _samplers_init()
656 sampler = GNUNET_new (struct RPS_Sampler);
659 if (NULL == (sampler->file_name = GNUNET_DISK_mktemp ("sampler-")))
660 LOG (GNUNET_ERROR_TYPE_WARNING,
661 "Could not create file\n");
662 LOG (GNUNET_ERROR_TYPE_DEBUG,
663 "Initialised sampler %s\n",
667 sampler->sampler_size = 0;
668 sampler->sampler_elements = NULL;
669 sampler->max_round_interval = max_round_interval;
670 //sampler->sampler_elements = GNUNET_new_array(init_size, struct GNUNET_PeerIdentity);
671 //GNUNET_array_grow (sampler->sampler_elements, sampler->sampler_size, min_size);
672 RPS_sampler_resize (sampler, init_size);
674 client_get_index = 0;
676 //GNUNET_assert (init_size == sampler->sampler_size);
682 * A fuction to update every sampler in the given list
684 * @param sampler the sampler to update.
685 * @param id the PeerID that is put in the sampler
688 RPS_sampler_update (struct RPS_Sampler *sampler,
689 const struct GNUNET_PeerIdentity *id)
694 to_file (sampler->file_name,
696 GNUNET_i2s_full (id));
699 for (i = 0 ; i < sampler->sampler_size ; i++)
701 RPS_sampler_elem_next (sampler->sampler_elements[i],
709 * Reinitialise all previously initialised sampler elements with the given value.
711 * Used to get rid of a PeerID.
713 * @param sampler the sampler to reinitialise a sampler element in.
714 * @param id the id of the sampler elements to update.
717 RPS_sampler_reinitialise_by_value (struct RPS_Sampler *sampler,
718 const struct GNUNET_PeerIdentity *id)
722 for ( i = 0 ; i < sampler->sampler_size ; i++ )
724 if ( 0 == GNUNET_CRYPTO_cmp_peer_identity(id, &(sampler->sampler_elements[i]->peer_id)) )
726 LOG (GNUNET_ERROR_TYPE_DEBUG, "Reinitialising sampler\n");
727 RPS_sampler_elem_reinit (sampler->sampler_elements[i]);
734 * Get one random peer out of the sampled peers.
736 * We might want to reinitialise this sampler after giving the
737 * corrsponding peer to the client.
738 * Only used internally
741 sampler_get_rand_peer2 (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
743 struct GetPeerCls *gpc = cls;
746 gpc->get_peer_task = NULL;
747 GNUNET_CONTAINER_DLL_remove (gpc_head, gpc_tail, gpc);
748 if (0 != (tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN))
752 * Choose the r_index of the peer we want to return
753 * at random from the interval of the gossip list
755 r_index = GNUNET_CRYPTO_random_u64 (GNUNET_CRYPTO_QUALITY_STRONG,
756 gpc->sampler->sampler_size);
758 if ( EMPTY == gpc->sampler->sampler_elements[r_index]->is_empty )
760 gpc->get_peer_task = GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_relative_multiply(
761 GNUNET_TIME_UNIT_SECONDS,
763 &sampler_get_rand_peer2,
768 *gpc->id = gpc->sampler->sampler_elements[r_index]->peer_id;
770 gpc->cont (gpc->cont_cls, gpc->id);
776 * Get one random peer out of the sampled peers.
778 * We might want to reinitialise this sampler after giving the
779 * corrsponding peer to the client.
782 sampler_get_rand_peer (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
784 struct GetPeerCls *gpc = cls;
785 struct GNUNET_PeerIdentity tmp_id;
786 unsigned int empty_flag;
787 struct RPS_SamplerElement *s_elem;
788 struct GNUNET_TIME_Relative last_request_diff;
789 uint32_t tmp_client_get_index;
791 gpc->get_peer_task = NULL;
792 if (0 != (tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN))
795 LOG (GNUNET_ERROR_TYPE_DEBUG, "Single peer was requested\n");
798 /* Store the next #client_get_index to check whether we cycled over the whole list */
799 if (0 < client_get_index)
800 tmp_client_get_index = client_get_index - 1;
802 tmp_client_get_index = gpc->sampler->sampler_size - 1;
804 LOG (GNUNET_ERROR_TYPE_DEBUG,
805 "sched for later if index reaches %" PRIX32 " (sampler size: %" PRIX32 ").\n",
806 tmp_client_get_index, gpc->sampler->sampler_size);
809 { /* Get first non empty sampler */
810 if (tmp_client_get_index == client_get_index)
811 { /* We once cycled over the whole list */
812 LOG (GNUNET_ERROR_TYPE_DEBUG, "reached tmp_index %" PRIX32 ".\n",
814 GNUNET_assert (NULL == gpc->get_peer_task);
816 GNUNET_SCHEDULER_add_delayed (gpc->sampler->max_round_interval,
817 &sampler_get_rand_peer,
822 tmp_id = gpc->sampler->sampler_elements[client_get_index]->peer_id;
823 empty_flag = gpc->sampler->sampler_elements[client_get_index]->is_empty;
824 RPS_sampler_elem_reinit (gpc->sampler->sampler_elements[client_get_index]);
825 if (EMPTY != empty_flag)
826 RPS_sampler_elem_next (gpc->sampler->sampler_elements[client_get_index],
830 /* Cycle the #client_get_index one step further */
831 if ( client_get_index == gpc->sampler->sampler_size - 1 )
832 client_get_index = 0;
836 LOG (GNUNET_ERROR_TYPE_DEBUG, "incremented index to %" PRIX32 ".\n",
838 } while (EMPTY == gpc->sampler->sampler_elements[client_get_index]->is_empty);
840 s_elem = gpc->sampler->sampler_elements[client_get_index];
841 *gpc->id = s_elem->peer_id;
843 /* Check whether we may use this sampler to give it back to the client */
844 if (GNUNET_TIME_UNIT_FOREVER_ABS.abs_value_us != s_elem->last_client_request.abs_value_us)
847 GNUNET_TIME_absolute_get_difference (s_elem->last_client_request,
848 GNUNET_TIME_absolute_get ());
849 /* We're not going to give it back now if it was
850 * already requested by a client this round */
851 if (last_request_diff.rel_value_us < gpc->sampler->max_round_interval.rel_value_us)
853 LOG (GNUNET_ERROR_TYPE_DEBUG,
854 "Last client request on this sampler was less than max round interval ago -- scheduling for later\n");
855 ///* How many time remains untile the next round has started? */
856 //inv_last_request_diff =
857 // GNUNET_TIME_absolute_get_difference (last_request_diff,
858 // sampler->max_round_interval);
859 // add a little delay
860 /* Schedule it one round later */
861 GNUNET_assert (NULL == gpc->get_peer_task);
863 GNUNET_SCHEDULER_add_delayed (gpc->sampler->max_round_interval,
864 &sampler_get_rand_peer,
868 // TODO add other reasons to wait here
871 s_elem->last_client_request = GNUNET_TIME_absolute_get ();
873 GNUNET_CONTAINER_DLL_remove (gpc_head, gpc_tail, gpc);
874 gpc->cont (gpc->cont_cls, gpc->id);
880 * Get n random peers out of the sampled peers.
882 * We might want to reinitialise this sampler after giving the
883 * corrsponding peer to the client.
884 * Random with or without consumption?
886 * @param sampler the sampler to get peers from.
887 * @param cb callback that will be called once the ids are ready.
888 * @param cls closure given to @a cb
889 * @param for_client #GNUNET_YES if result is used for client,
890 * #GNUNET_NO if used internally
891 * @param num_peers the number of peers requested
894 RPS_sampler_get_n_rand_peers (struct RPS_Sampler *sampler,
895 RPS_sampler_n_rand_peers_ready_cb cb,
896 void *cls, uint32_t num_peers, int for_client)
898 GNUNET_assert (0 != sampler->sampler_size);
900 // TODO check if we have too much (distinct) sampled peers
902 struct NRandPeersReadyCls *cb_cls;
903 struct GetPeerCls *gpc;
905 cb_cls = GNUNET_new (struct NRandPeersReadyCls);
906 cb_cls->num_peers = num_peers;
907 cb_cls->cur_num_peers = 0;
908 cb_cls->ids = GNUNET_new_array (num_peers, struct GNUNET_PeerIdentity);
909 cb_cls->callback = cb;
913 if (GNUNET_NO == for_client)
915 to_file (sampler->file_name,
916 "This sampler is probably for Brahms itself");
918 else if (GNUNET_YES == for_client)
920 to_file (sampler->file_name,
921 "This sampler is probably for the client");
925 to_file (sampler->file_name,
926 "This shouldn't happen: for_client is %i",
931 LOG (GNUNET_ERROR_TYPE_DEBUG,
932 "Scheduling requests for %" PRIu32 " peers\n", num_peers);
934 for (i = 0 ; i < num_peers ; i++)
936 gpc = GNUNET_new (struct GetPeerCls);
937 gpc->sampler = sampler;
938 gpc->cont = check_n_peers_ready;
939 gpc->cont_cls = cb_cls;
940 gpc->id = &cb_cls->ids[i];
942 // maybe add a little delay
943 if (GNUNET_YES == for_client)
944 gpc->get_peer_task = GNUNET_SCHEDULER_add_now (&sampler_get_rand_peer, gpc);
945 else if (GNUNET_NO == for_client)
946 gpc->get_peer_task = GNUNET_SCHEDULER_add_now (&sampler_get_rand_peer2, gpc);
950 GNUNET_CONTAINER_DLL_insert (gpc_head, gpc_tail, gpc);
956 * Counts how many Samplers currently hold a given PeerID.
958 * @param sampler the sampler to count ids in.
959 * @param id the PeerID to count.
961 * @return the number of occurrences of id.
964 RPS_sampler_count_id (struct RPS_Sampler *sampler,
965 const struct GNUNET_PeerIdentity *id)
971 for ( i = 0 ; i < sampler->sampler_size ; i++ )
973 if ( 0 == GNUNET_CRYPTO_cmp_peer_identity (&sampler->sampler_elements[i]->peer_id, id)
974 && EMPTY != sampler->sampler_elements[i]->is_empty)
982 * Cleans the sampler.
985 RPS_sampler_destroy (struct RPS_Sampler *sampler)
987 struct GetPeerCls *i;
989 for (i = gpc_head; NULL != i; i = gpc_head)
991 GNUNET_CONTAINER_DLL_remove (gpc_head, gpc_tail, i);
992 GNUNET_SCHEDULER_cancel (i->get_peer_task);
996 sampler_empty (sampler);
997 GNUNET_free (sampler);
1000 /* end of gnunet-service-rps.c */