- compiler warning
[oweals/gnunet.git] / src / rps / gnunet-service-rps_sampler.c
1 /*
2      This file is part of GNUnet.
3      Copyright (C)
4
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.
9
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.
14
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., 51 Franklin Street, Fifth Floor,
18      Boston, MA 02110-1301, USA.
19 */
20
21 /**
22  * @file rps/gnunet-service-rps_sampler.c
23  * @brief sampler implementation
24  * @author Julius Bünger
25  */
26 #include "platform.h"
27 #include "gnunet_util_lib.h"
28 #include "rps.h"
29
30 #include "gnunet-service-rps_sampler.h"
31 #include "gnunet-service-rps_sampler_elem.h"
32
33 #include <math.h>
34 #include <inttypes.h>
35
36 #include "rps-test_util.h"
37
38 #define LOG(kind, ...) GNUNET_log_from(kind,"rps-sampler",__VA_ARGS__)
39
40
41 // multiple 'clients'?
42
43 // TODO check for overflows
44
45 // TODO align message structs
46
47 // hist_size_init, hist_size_max
48
49 /***********************************************************************
50  * WARNING: This section needs to be reviewed regarding the use of
51  * functions providing (pseudo)randomness!
52 ***********************************************************************/
53
54 // TODO care about invalid input of the caller (size 0 or less...)
55
56 /**
57  * Callback that is called from _get_rand_peer() when the PeerID is ready.
58  *
59  * @param cls the closure given alongside this function.
60  * @param id the PeerID that was returned
61  */
62 typedef void
63 (*RPS_sampler_rand_peer_ready_cont) (void *cls,
64                                      const struct GNUNET_PeerIdentity *id);
65
66
67 /**
68  * Closure for #sampler_mod_get_rand_peer() and #sampler_get_rand_peer
69  */
70 struct GetPeerCls
71 {
72   /**
73    * DLL
74    */
75   struct GetPeerCls *next;
76   struct GetPeerCls *prev;
77
78   /**
79    * The #RPS_SamplerRequestHandle this single request belongs to.
80    */
81   struct RPS_SamplerRequestHandle *req_handle;
82
83   /**
84    * The task for this function.
85    */
86   struct GNUNET_SCHEDULER_Task *get_peer_task;
87
88   /**
89    * The callback
90    */
91   RPS_sampler_rand_peer_ready_cont cont;
92
93   /**
94    * The closure to the callback @e cont
95    */
96   void *cont_cls;
97
98   /**
99    * The address of the id to be stored at
100    */
101   struct GNUNET_PeerIdentity *id;
102 };
103
104
105 /**
106  * Type of function used to differentiate between modified and not modified
107  * Sampler.
108  */
109 typedef void
110 (*RPS_get_peers_type) (void *cls,
111                        const struct GNUNET_SCHEDULER_TaskContext *tc);
112
113 /**
114  * Get one random peer out of the sampled peers.
115  *
116  * We might want to reinitialise this sampler after giving the
117  * corrsponding peer to the client.
118  * Only used internally
119  */
120 static void
121 sampler_get_rand_peer (void *cls,
122                         const struct GNUNET_SCHEDULER_TaskContext *tc);
123
124 /**
125  * Get one random peer out of the sampled peers.
126  *
127  * We might want to reinitialise this sampler after giving the
128  * corrsponding peer to the client.
129  */
130 static void
131 sampler_mod_get_rand_peer (void *cls,
132                        const struct GNUNET_SCHEDULER_TaskContext *tc);
133
134
135 /**
136  * Sampler with its own array of SamplerElements
137  */
138 struct RPS_Sampler
139 {
140   /**
141    * Number of sampler elements we hold.
142    */
143   unsigned int sampler_size;
144   //size_t size;
145
146   /**
147    * All sampler elements in one array.
148    */
149   struct RPS_SamplerElement **sampler_elements;
150
151   /**
152    * Maximum time a round takes
153    *
154    * Used in the context of RPS
155    */
156   struct GNUNET_TIME_Relative max_round_interval;
157
158   /**
159    * Stores the function to return peers. Which one it is depends on whether
160    * the Sampler is the modified one or not.
161    */
162   RPS_get_peers_type get_peers;
163
164   /**
165    * Head and tail for the DLL to store the #RPS_SamplerRequestHandle
166    */
167   struct RPS_SamplerRequestHandle *req_handle_head;
168   struct RPS_SamplerRequestHandle *req_handle_tail;
169
170   #ifdef TO_FILE
171   /**
172    * File name to log to
173    */
174   char *file_name;
175   #endif /* TO_FILE */
176 };
177
178 /**
179  * Closure to _get_n_rand_peers_ready_cb()
180  */
181 struct RPS_SamplerRequestHandle
182 {
183   /**
184    * DLL
185    */
186   struct RPS_SamplerRequestHandle *next;
187   struct RPS_SamplerRequestHandle *prev;
188
189   /**
190    * Number of peers we are waiting for.
191    */
192   uint32_t num_peers;
193
194   /**
195    * Number of peers we currently have.
196    */
197   uint32_t cur_num_peers;
198
199   /**
200    * Pointer to the array holding the ids.
201    */
202   struct GNUNET_PeerIdentity *ids;
203
204   /**
205    * Head and tail for the DLL to store the tasks for single requests
206    */
207   struct GetPeerCls *gpc_head;
208   struct GetPeerCls *gpc_tail;
209
210   /**
211    * Sampler.
212    */
213   struct RPS_Sampler *sampler;
214
215   /**
216    * Callback to be called when all ids are available.
217    */
218   RPS_sampler_n_rand_peers_ready_cb callback;
219
220   /**
221    * Closure given to the callback
222    */
223   void *cls;
224 };
225
226 ///**
227 // * Global sampler variable.
228 // */
229 //struct RPS_Sampler *sampler;
230
231
232 /**
233  * The minimal size for the extended sampler elements.
234  */
235 static size_t min_size;
236
237 /**
238  * The maximal size the extended sampler elements should grow to.
239  */
240 static size_t max_size;
241
242 /**
243  * The size the extended sampler elements currently have.
244  */
245 //static size_t extra_size;
246
247 /**
248  * Inedex to the sampler element that is the next to be returned
249  */
250 static uint32_t client_get_index;
251
252
253 /**
254  * Callback to _get_rand_peer() used by _get_n_rand_peers().
255  *
256  * Checks whether all n peers are available. If they are,
257  * give those back.
258  */
259 static void
260 check_n_peers_ready (void *cls,
261     const struct GNUNET_PeerIdentity *id)
262 {
263   struct RPS_SamplerRequestHandle *req_handle = cls;
264
265   req_handle->cur_num_peers++;
266   LOG (GNUNET_ERROR_TYPE_DEBUG,
267       "Got %" PRIX32 ". of %" PRIX32 " peers\n",
268       req_handle->cur_num_peers, req_handle->num_peers);
269
270   if (req_handle->num_peers == req_handle->cur_num_peers)
271   { /* All peers are ready -- return those to the client */
272     GNUNET_assert (NULL != req_handle->callback);
273
274     LOG (GNUNET_ERROR_TYPE_DEBUG,
275         "returning %" PRIX32 " peers to the client\n",
276         req_handle->num_peers);
277     req_handle->callback (req_handle->cls, req_handle->ids, req_handle->num_peers);
278
279     RPS_sampler_request_cancel (req_handle);
280   }
281 }
282
283
284 /**
285  * Get the size of the sampler.
286  *
287  * @param sampler the sampler to return the size of.
288  * @return the size of the sampler
289  */
290 unsigned int
291 RPS_sampler_get_size (struct RPS_Sampler *sampler)
292 {
293   return sampler->sampler_size;
294 }
295
296
297 /**
298  * Grow or shrink the size of the sampler.
299  *
300  * @param sampler the sampler to resize.
301  * @param new_size the new size of the sampler
302  */
303 static void
304 sampler_resize (struct RPS_Sampler *sampler, unsigned int new_size)
305 {
306   unsigned int old_size;
307   uint32_t i;
308
309   // TODO check min and max size
310
311   old_size = sampler->sampler_size;
312
313   if (old_size > new_size)
314   { /* Shrinking */
315
316     LOG (GNUNET_ERROR_TYPE_DEBUG,
317          "Shrinking sampler %d -> %d\n",
318          old_size,
319          new_size);
320
321     to_file (sampler->file_name,
322          "Shrinking sampler %d -> %d",
323          old_size,
324          new_size);
325
326     for (i = new_size ; i < old_size ; i++)
327     {
328       to_file (sampler->file_name,
329                "-%" PRIu32 ": %s",
330                i,
331                sampler->sampler_elements[i]->file_name);
332     }
333
334     GNUNET_array_grow (sampler->sampler_elements,
335                        sampler->sampler_size,
336                        new_size);
337     LOG (GNUNET_ERROR_TYPE_DEBUG,
338          "sampler->sampler_elements now points to %p\n",
339          sampler->sampler_elements);
340
341   }
342   else if (old_size < new_size)
343   { /* Growing */
344     LOG (GNUNET_ERROR_TYPE_DEBUG,
345          "Growing sampler %d -> %d\n",
346          old_size,
347          new_size);
348
349     to_file (sampler->file_name,
350          "Growing sampler %d -> %d",
351          old_size,
352          new_size);
353
354     GNUNET_array_grow (sampler->sampler_elements,
355         sampler->sampler_size,
356         new_size);
357
358     for (i = old_size ; i < new_size ; i++)
359     { /* Add new sampler elements */
360       sampler->sampler_elements[i] = RPS_sampler_elem_create ();
361
362       to_file (sampler->file_name,
363                "+%" PRIu32 ": %s",
364                i,
365                sampler->sampler_elements[i]->file_name);
366     }
367   }
368   else
369   {
370     LOG (GNUNET_ERROR_TYPE_DEBUG, "Size remains the same -- nothing to do\n");
371     return;
372   }
373
374   GNUNET_assert (sampler->sampler_size == new_size);
375 }
376
377
378 /**
379  * Grow or shrink the size of the sampler.
380  *
381  * @param sampler the sampler to resize.
382  * @param new_size the new size of the sampler
383  */
384 void
385 RPS_sampler_resize (struct RPS_Sampler *sampler, unsigned int new_size)
386 {
387   GNUNET_assert (0 < new_size);
388   sampler_resize (sampler, new_size);
389 }
390
391
392 /**
393  * Empty the sampler.
394  *
395  * @param sampler the sampler to empty.
396  * @param new_size the new size of the sampler
397  */
398 static void
399 sampler_empty (struct RPS_Sampler *sampler)
400 {
401   sampler_resize (sampler, 0);
402 }
403
404
405 /**
406  * Initialise a tuple of sampler elements.
407  *
408  * @param init_size the size the sampler is initialised with
409  * @param max_round_interval maximum time a round takes
410  * @return a handle to a sampler that consists of sampler elements.
411  */
412 struct RPS_Sampler *
413 RPS_sampler_init (size_t init_size,
414                   struct GNUNET_TIME_Relative max_round_interval)
415 {
416   struct RPS_Sampler *sampler;
417
418   /* Initialise context around extended sampler */
419   min_size = 10; // TODO make input to _samplers_init()
420   max_size = 1000; // TODO make input to _samplers_init()
421
422   sampler = GNUNET_new (struct RPS_Sampler);
423
424   #ifdef TO_FILE
425   sampler->file_name = create_file ("sampler-");
426
427   LOG (GNUNET_ERROR_TYPE_DEBUG,
428        "Initialised sampler %s\n",
429        sampler->file_name);
430   #endif /* TO_FILE */
431
432   sampler->max_round_interval = max_round_interval;
433   sampler->get_peers = sampler_get_rand_peer;
434   //sampler->sampler_elements = GNUNET_new_array(init_size, struct GNUNET_PeerIdentity);
435   //GNUNET_array_grow (sampler->sampler_elements, sampler->sampler_size, min_size);
436   RPS_sampler_resize (sampler, init_size);
437
438   client_get_index = 0;
439
440   //GNUNET_assert (init_size == sampler->sampler_size);
441   return sampler;
442 }
443
444 /**
445  * Initialise a modified tuple of sampler elements.
446  *
447  * @param init_size the size the sampler is initialised with
448  * @param max_round_interval maximum time a round takes
449  * @return a handle to a sampler that consists of sampler elements.
450  */
451 struct RPS_Sampler *
452 RPS_sampler_mod_init (size_t init_size,
453                       struct GNUNET_TIME_Relative max_round_interval)
454 {
455   struct RPS_Sampler *sampler;
456
457   sampler = RPS_sampler_init (init_size, max_round_interval);
458   sampler->get_peers = sampler_mod_get_rand_peer;
459
460   LOG (GNUNET_ERROR_TYPE_DEBUG,
461        "Initialised modified sampler %s\n",
462        sampler->file_name);
463   to_file (sampler->file_name,
464            "This is a modified sampler");
465
466   return sampler;
467 }
468
469
470 /**
471  * A fuction to update every sampler in the given list
472  *
473  * @param sampler the sampler to update.
474  * @param id the PeerID that is put in the sampler
475  */
476   void
477 RPS_sampler_update (struct RPS_Sampler *sampler,
478                     const struct GNUNET_PeerIdentity *id)
479 {
480   uint32_t i;
481
482   to_file (sampler->file_name,
483            "Got %s",
484            GNUNET_i2s_full (id));
485
486   for (i = 0 ; i < sampler->sampler_size ; i++)
487   {
488     RPS_sampler_elem_next (sampler->sampler_elements[i],
489                            id);
490   }
491
492 }
493
494
495 /**
496  * Reinitialise all previously initialised sampler elements with the given value.
497  *
498  * Used to get rid of a PeerID.
499  *
500  * @param sampler the sampler to reinitialise a sampler element in.
501  * @param id the id of the sampler elements to update.
502  */
503   void
504 RPS_sampler_reinitialise_by_value (struct RPS_Sampler *sampler,
505                                    const struct GNUNET_PeerIdentity *id)
506 {
507   uint32_t i;
508   struct RPS_SamplerElement *trash_entry;
509
510   for ( i = 0 ; i < sampler->sampler_size ; i++ )
511   {
512     if ( 0 == GNUNET_CRYPTO_cmp_peer_identity(id, &(sampler->sampler_elements[i]->peer_id)) )
513     {
514       LOG (GNUNET_ERROR_TYPE_DEBUG, "Reinitialising sampler\n");
515       trash_entry = GNUNET_new (struct RPS_SamplerElement);
516       *trash_entry = *(sampler->sampler_elements[i]);
517       to_file (trash_entry->file_name,
518                "--- non-active");
519       RPS_sampler_elem_reinit (sampler->sampler_elements[i]);
520     }
521   }
522 }
523
524
525 /**
526  * Get one random peer out of the sampled peers.
527  *
528  * We might want to reinitialise this sampler after giving the
529  * corrsponding peer to the client.
530  * Only used internally
531  */
532 static void
533 sampler_get_rand_peer (void *cls,
534                         const struct GNUNET_SCHEDULER_TaskContext *tc)
535 {
536   struct GetPeerCls *gpc = cls;
537   uint32_t r_index;
538   struct RPS_Sampler *sampler;
539
540   gpc->get_peer_task = NULL;
541   if (0 != (tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN))
542     return;
543   sampler = gpc->req_handle->sampler;
544
545   /**;
546    * Choose the r_index of the peer we want to return
547    * at random from the interval of the gossip list
548    */
549   r_index = GNUNET_CRYPTO_random_u64 (GNUNET_CRYPTO_QUALITY_STRONG,
550       sampler->sampler_size);
551
552   if (EMPTY == sampler->sampler_elements[r_index]->is_empty)
553   {
554     //LOG (GNUNET_ERROR_TYPE_DEBUG,
555     //     "Not returning randomly selected, empty PeerID. - Rescheduling.\n");
556
557     /* FIXME no active wait - get notified, when new id arrives?
558      * Might also be a freshly emptied one. Others might still contain ids.
559      * Counter?
560      */
561     gpc->get_peer_task =
562       GNUNET_SCHEDULER_add_delayed (
563           GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 1),
564           &sampler_get_rand_peer,
565           cls);
566     return;
567   }
568
569   GNUNET_CONTAINER_DLL_remove (gpc->req_handle->gpc_head,
570                                gpc->req_handle->gpc_tail,
571                                gpc);
572   *gpc->id = sampler->sampler_elements[r_index]->peer_id;
573   gpc->cont (gpc->cont_cls, gpc->id);
574
575   GNUNET_free (gpc);
576 }
577
578
579 /**
580  * Get one random peer out of the sampled peers.
581  *
582  * We might want to reinitialise this sampler after giving the
583  * corrsponding peer to the client.
584  */
585 static void
586 sampler_mod_get_rand_peer (void *cls,
587                        const struct GNUNET_SCHEDULER_TaskContext *tc)
588 {
589   struct GetPeerCls *gpc = cls;
590   struct RPS_SamplerElement *s_elem;
591   struct GNUNET_TIME_Relative last_request_diff;
592   struct RPS_Sampler *sampler;
593
594   gpc->get_peer_task = NULL;
595   if (0 != (tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN))
596     return;
597   sampler = gpc->req_handle->sampler;
598
599   LOG (GNUNET_ERROR_TYPE_DEBUG, "Single peer was requested\n");
600
601   /* Cycle the #client_get_index one step further */
602   client_get_index = (client_get_index + 1) % sampler->sampler_size;
603
604   s_elem = sampler->sampler_elements[client_get_index];
605   *gpc->id = s_elem->peer_id;
606   GNUNET_assert (NULL != s_elem);
607
608   if (EMPTY == s_elem->is_empty)
609   {
610     LOG (GNUNET_ERROR_TYPE_DEBUG, "Sampler_mod element empty, rescheduling.\n");
611     GNUNET_assert (NULL == gpc->get_peer_task);
612     gpc->get_peer_task =
613       GNUNET_SCHEDULER_add_delayed (sampler->max_round_interval,
614                                     &sampler_mod_get_rand_peer,
615                                     cls);
616     return;
617   }
618
619   /* Check whether we may use this sampler to give it back to the client */
620   if (GNUNET_TIME_UNIT_FOREVER_ABS.abs_value_us != s_elem->last_client_request.abs_value_us)
621   {
622     last_request_diff =
623       GNUNET_TIME_absolute_get_difference (s_elem->last_client_request,
624                                            GNUNET_TIME_absolute_get ());
625     /* We're not going to give it back now if it was
626      * already requested by a client this round */
627     if (last_request_diff.rel_value_us < sampler->max_round_interval.rel_value_us)
628     {
629       LOG (GNUNET_ERROR_TYPE_DEBUG,
630           "Last client request on this sampler was less than max round interval ago -- scheduling for later\n");
631       ///* How many time remains untile the next round has started? */
632       //inv_last_request_diff =
633       //  GNUNET_TIME_absolute_get_difference (last_request_diff,
634       //                                       sampler->max_round_interval);
635       // add a little delay
636       /* Schedule it one round later */
637       GNUNET_assert (NULL == gpc->get_peer_task);
638       gpc->get_peer_task =
639         GNUNET_SCHEDULER_add_delayed (sampler->max_round_interval,
640                                       &sampler_mod_get_rand_peer,
641                                       cls);
642       return;
643     }
644     // TODO add other reasons to wait here
645   }
646
647   s_elem->last_client_request = GNUNET_TIME_absolute_get ();
648
649   GNUNET_CONTAINER_DLL_remove (gpc->req_handle->gpc_head,
650                                gpc->req_handle->gpc_tail,
651                                gpc);
652   gpc->cont (gpc->cont_cls, gpc->id);
653   GNUNET_free (gpc);
654 }
655
656
657 /**
658  * Get n random peers out of the sampled peers.
659  *
660  * We might want to reinitialise this sampler after giving the
661  * corrsponding peer to the client.
662  * Random with or without consumption?
663  *
664  * @param sampler the sampler to get peers from.
665  * @param cb callback that will be called once the ids are ready.
666  * @param cls closure given to @a cb
667  * @param for_client #GNUNET_YES if result is used for client,
668  *                   #GNUNET_NO if used internally
669  * @param num_peers the number of peers requested
670  */
671 struct RPS_SamplerRequestHandle *
672 RPS_sampler_get_n_rand_peers (struct RPS_Sampler *sampler,
673                               RPS_sampler_n_rand_peers_ready_cb cb,
674                               void *cls, uint32_t num_peers)
675 {
676   GNUNET_assert (0 != sampler->sampler_size);
677   if (0 == num_peers)
678     return NULL;
679
680   // TODO check if we have too much (distinct) sampled peers
681   uint32_t i;
682   struct RPS_SamplerRequestHandle *req_handle;
683   struct GetPeerCls *gpc;
684
685   req_handle = GNUNET_new (struct RPS_SamplerRequestHandle);
686   req_handle->num_peers = num_peers;
687   req_handle->cur_num_peers = 0;
688   req_handle->ids = GNUNET_new_array (num_peers, struct GNUNET_PeerIdentity);
689   req_handle->sampler = sampler;
690   req_handle->callback = cb;
691   req_handle->cls = cls;
692   GNUNET_CONTAINER_DLL_insert (sampler->req_handle_head,
693                                sampler->req_handle_tail,
694                                req_handle);
695
696   LOG (GNUNET_ERROR_TYPE_DEBUG,
697       "Scheduling requests for %" PRIu32 " peers\n", num_peers);
698
699   for (i = 0 ; i < num_peers ; i++)
700   {
701     gpc = GNUNET_new (struct GetPeerCls);
702     gpc->req_handle = req_handle;
703     gpc->cont = check_n_peers_ready;
704     gpc->cont_cls = req_handle;
705     gpc->id = &req_handle->ids[i];
706
707     GNUNET_CONTAINER_DLL_insert (req_handle->gpc_head,
708                                  req_handle->gpc_tail,
709                                  gpc);
710     // maybe add a little delay
711     gpc->get_peer_task = GNUNET_SCHEDULER_add_now (sampler->get_peers, gpc);
712   }
713   return req_handle;
714 }
715
716 /**
717  * Cancle a request issued through #RPS_sampler_n_rand_peers_ready_cb.
718  *
719  * @param req_handle the handle to the request
720  */
721 void
722 RPS_sampler_request_cancel (struct RPS_SamplerRequestHandle *req_handle)
723 {
724   struct GetPeerCls *i;
725
726   while (NULL != (i = req_handle->gpc_head) )
727   {
728     GNUNET_CONTAINER_DLL_remove (req_handle->gpc_head,
729                                  req_handle->gpc_tail,
730                                  i);
731     if (NULL != i->get_peer_task)
732       GNUNET_SCHEDULER_cancel (i->get_peer_task);
733     GNUNET_free (i);
734   }
735   GNUNET_CONTAINER_DLL_remove (req_handle->sampler->req_handle_head,
736                                req_handle->sampler->req_handle_tail,
737                                req_handle);
738   GNUNET_free (req_handle);
739 }
740
741
742 /**
743  * Counts how many Samplers currently hold a given PeerID.
744  *
745  * @param sampler the sampler to count ids in.
746  * @param id the PeerID to count.
747  *
748  * @return the number of occurrences of id.
749  */
750   uint32_t
751 RPS_sampler_count_id (struct RPS_Sampler *sampler,
752                       const struct GNUNET_PeerIdentity *id)
753 {
754   uint32_t count;
755   uint32_t i;
756
757   count = 0;
758   for ( i = 0 ; i < sampler->sampler_size ; i++ )
759   {
760     if ( 0 == GNUNET_CRYPTO_cmp_peer_identity (&sampler->sampler_elements[i]->peer_id, id)
761         && EMPTY != sampler->sampler_elements[i]->is_empty)
762       count++;
763   }
764   return count;
765 }
766
767
768 /**
769  * Cleans the sampler.
770  */
771   void
772 RPS_sampler_destroy (struct RPS_Sampler *sampler)
773 {
774   if (NULL != sampler->req_handle_head)
775   {
776     LOG (GNUNET_ERROR_TYPE_WARNING,
777         "There are still pending requests. Going to remove them.\n");
778     while (NULL != sampler->req_handle_head)
779       RPS_sampler_request_cancel (sampler->req_handle_head);
780   }
781   sampler_empty (sampler);
782   GNUNET_free (sampler);
783 }
784
785 /* end of gnunet-service-rps.c */