fixing segfault caused by missing hashmap init
[oweals/gnunet.git] / src / ats / ats_api.c
1 /*
2      This file is part of GNUnet.
3      (C) 2010,2011 Christian Grothoff (and other contributing authors)
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., 59 Temple Place - Suite 330,
18      Boston, MA 02111-1307, USA.
19 */
20 /**
21  * @file ats/ats_api.c
22  * @brief automatic transport selection API
23  * @author Christian Grothoff
24  * @author Matthias Wachs
25  *
26  * TODO:
27  * - write test case
28  * - extend API to get performance data
29  * - implement simplistic strategy based on say 'lowest latency' or strict ordering
30  * - extend API to get peer preferences, implement proportional bandwidth assignment
31  * - re-implement API against a real ATS service (!)
32  */
33 #include "platform.h"
34 #include "gnunet_ats_service.h"
35
36 // NOTE: this implementation is simply supposed
37 // to implement a simplistic strategy in-process;
38 // in the future, we plan to replace it with a real
39 // service implementation
40
41 /**
42  * Allocation record for a peer's address.
43  */
44 struct AllocationRecord
45 {
46
47   /**
48    * Performance information associated with this address (array).
49    */
50   struct GNUNET_TRANSPORT_ATS_Information *ats;
51
52   /**
53    * Name of the plugin
54    */
55   char *plugin_name;
56
57   /**
58    * Address this record represents, allocated at the end of this struct.
59    */
60   const void *plugin_addr;
61
62   /**
63    * Session associated with this record.
64    */
65   struct Session *session;
66
67   /**
68    * Number of bytes in plugin_addr.
69    */
70   size_t plugin_addr_len;
71
72   /**
73    * Number of entries in 'ats'.
74    */
75   uint32_t ats_count;
76
77   /**
78    * Bandwidth assigned to this address right now, 0 for none.
79    */
80   struct GNUNET_BANDWIDTH_Value32NBO bandwidth;
81
82   /**
83    * Set to GNUNET_YES if this is the connected address of a connected peer.
84    */
85   int connected;
86
87 };
88
89
90 /**
91  * Opaque handle to obtain address suggestions.
92  */
93 struct GNUNET_ATS_SuggestionContext
94 {
95
96   /**
97    * Function to call with our final suggestion.
98    */
99   GNUNET_ATS_AddressSuggestionCallback cb;
100
101   /**
102    * Closure for 'cb'.
103    */
104   void *cb_cls;
105
106   /**
107    * Global ATS handle.
108    */
109   struct GNUNET_ATS_Handle *atc;
110
111   /**
112    * Which peer are we monitoring?
113    */
114   struct GNUNET_PeerIdentity target;
115
116 };
117
118
119 /**
120  * Handle to the ATS subsystem.
121  */
122 struct GNUNET_ATS_Handle
123 {
124   /**
125    * Configuration.
126    */
127   const struct GNUNET_CONFIGURATION_Handle *cfg;
128
129   /**
130    * Function to call when the allocation changes.
131    */
132   GNUNET_TRANSPORT_ATS_AllocationNotification alloc_cb;
133
134   /**
135    * Closure for 'alloc_cb'.
136    */
137   void *alloc_cb_cls;
138
139   /**
140    * Information about all connected peers.  Maps peer identities
141    * to one or more 'struct AllocationRecord' values.
142    */
143   struct GNUNET_CONTAINER_MultiHashMap *peers;
144
145   /**
146    * Map of PeerIdentities to 'struct GNUNET_ATS_SuggestionContext's.
147    */
148   struct GNUNET_CONTAINER_MultiHashMap *notify_map;
149
150
151   /**
152    * Task scheduled to update our bandwidth assignment.
153    */
154   GNUNET_SCHEDULER_TaskIdentifier ba_task;
155
156   /**
157    * Total bandwidth per configuration.
158    */
159   unsigned long long total_bps;
160 };
161
162
163 /**
164  * Count number of connected records.
165  *
166  * @param cls pointer to counter
167  * @param key identity of the peer associated with the records
168  * @param value a 'struct AllocationRecord' 
169  * @return GNUNET_YES (continue iteration)
170  */
171 static int
172 count_connections (void *cls, const GNUNET_HashCode * key, void *value)
173 {
174   unsigned int *ac = cls;
175   struct AllocationRecord *ar = value;
176
177   if (GNUNET_YES == ar->connected)
178     (*ac)++;
179   return GNUNET_YES;
180 }
181
182
183 /**
184  * Closure for 'set_bw_connections'.
185  */
186 struct SetBandwidthContext
187 {
188   /**
189    * ATS handle.
190    */
191   struct GNUNET_ATS_Handle *atc;
192
193   /**
194    * Bandwidth to assign.
195    */
196   struct GNUNET_BANDWIDTH_Value32NBO bw;
197 };
198
199
200 /**
201  * Set bandwidth based on record.
202  *
203  * @param cls 'struct SetBandwidthContext'
204  * @param key identity of the peer associated with the records
205  * @param value a 'struct AllocationRecord' 
206  * @return GNUNET_YES (continue iteration)
207  */
208 static int
209 set_bw_connections (void *cls, const GNUNET_HashCode * key, void *value)
210 {
211   struct SetBandwidthContext *sbc = cls;
212   struct AllocationRecord *ar = value;
213
214   if (GNUNET_YES == ar->connected)
215   {
216     ar->bandwidth = sbc->bw;
217     sbc->atc->alloc_cb (sbc->atc->alloc_cb_cls,
218                         (const struct GNUNET_PeerIdentity *) key,
219                         ar->plugin_name, ar->session, ar->plugin_addr,
220                         ar->plugin_addr_len, ar->bandwidth);
221   }
222   else if (ntohl (ar->bandwidth.value__) > 0)
223   {
224     ar->bandwidth = GNUNET_BANDWIDTH_value_init (0);
225     sbc->atc->alloc_cb (sbc->atc->alloc_cb_cls,
226                         (const struct GNUNET_PeerIdentity *) key,
227                         ar->plugin_name, ar->session, ar->plugin_addr,
228                         ar->plugin_addr_len, ar->bandwidth);
229   }
230   return GNUNET_YES;
231 }
232
233
234 /**
235  * Task run to update bandwidth assignments.
236  *
237  * @param cls the 'struct GNUNET_ATS_Handle'
238  * @param tc scheduler context
239  */
240 static void
241 update_bandwidth_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
242 {
243   struct GNUNET_ATS_Handle *atc = cls;
244   unsigned int ac;
245   struct SetBandwidthContext bwc;
246
247   atc->ba_task = GNUNET_SCHEDULER_NO_TASK;
248   /* FIXME: update calculations NICELY; what follows is a naive version */
249   GNUNET_CONTAINER_multihashmap_iterate (atc->peers, &count_connections, &ac);
250   bwc.atc = atc;
251   bwc.bw = GNUNET_BANDWIDTH_value_init (atc->total_bps / ac);
252   GNUNET_CONTAINER_multihashmap_iterate (atc->peers, &set_bw_connections, &bwc);
253 }
254
255
256 /**
257  * Calculate an updated bandwidth assignment and notify.
258  *
259  * @param ats handle
260  * @param change which allocation record changed?
261  */
262 static void
263 update_bandwidth_assignment (struct GNUNET_ATS_Handle *atc,
264                              struct AllocationRecord *change)
265 {
266   /* FIXME: based on the 'change', update the LP-problem... */
267   if (atc->ba_task == GNUNET_SCHEDULER_NO_TASK)
268     atc->ba_task = GNUNET_SCHEDULER_add_now (&update_bandwidth_task, atc);
269 }
270
271
272 /**
273  * Function called with feasbile addresses we might want to suggest.
274  *
275  * @param cls the 'struct GNUNET_ATS_SuggestionContext'
276  * @param key identity of the peer
277  * @param value a 'struct AllocationRecord' for the peer
278  * @return GNUNET_NO if we're done, GNUNET_YES if we did not suggest an address yet
279  */
280 static int
281 suggest_address (void *cls, const GNUNET_HashCode * key, void *value)
282 {
283   struct GNUNET_ATS_SuggestionContext *asc = cls;
284   struct AllocationRecord *ar = value;
285
286   /* trivial strategy: pick first available address... */
287   asc->cb (asc->cb_cls, &asc->target, ar->plugin_name, ar->plugin_addr,
288            ar->plugin_addr_len,
289            GNUNET_BANDWIDTH_value_init (asc->atc->total_bps / 32), ar->ats,
290            ar->ats_count);
291   asc->cb = NULL;
292   return GNUNET_NO;
293 }
294
295
296 /**
297  * We would like to establish a new connection with a peer.
298  * ATS should suggest a good address to begin with.
299  *
300  * @param atc handle
301  * @param peer identity of the new peer
302  * @param cb function to call with the address
303  * @param cb_cls closure for cb
304  */
305 struct GNUNET_ATS_SuggestionContext *
306 GNUNET_ATS_suggest_address (struct GNUNET_ATS_Handle *atc,
307                             const struct GNUNET_PeerIdentity *peer,
308                             GNUNET_ATS_AddressSuggestionCallback cb,
309                             void *cb_cls)
310 {
311   struct GNUNET_ATS_SuggestionContext *asc;
312
313   asc = GNUNET_malloc (sizeof (struct GNUNET_ATS_SuggestionContext));
314   asc->cb = cb;
315   asc->cb_cls = cb_cls;
316   asc->atc = atc;
317   asc->target = *peer;
318   GNUNET_CONTAINER_multihashmap_get_multiple (atc->peers, &peer->hashPubKey,
319                                               &suggest_address, asc);
320   if (NULL == asc->cb)
321   {
322     GNUNET_free (asc);
323     return NULL;
324   }
325   GNUNET_CONTAINER_multihashmap_put (atc->notify_map, &peer->hashPubKey, asc,
326                                      GNUNET_CONTAINER_MULTIHASHMAPOPTION_MULTIPLE);
327   return asc;
328 }
329
330
331 /**
332  * Cancel suggestion request.
333  *
334  * @param asc handle of the request to cancel
335  */
336 void
337 GNUNET_ATS_suggest_address_cancel (struct GNUNET_ATS_SuggestionContext *asc)
338 {
339   GNUNET_assert (GNUNET_OK ==
340                  GNUNET_CONTAINER_multihashmap_remove (asc->atc->notify_map,
341                                                        &asc->target.hashPubKey,
342                                                        asc));
343   GNUNET_free (asc);
344 }
345
346
347 /**
348  * Initialize the ATS subsystem.
349  *
350  * @param cfg configuration to use
351  * @param alloc_cb notification to call whenever the allocation changed
352  * @param alloc_cb_cls closure for 'alloc_cb'
353  * @return ats context
354  */
355 struct GNUNET_ATS_Handle *
356 GNUNET_ATS_init (const struct GNUNET_CONFIGURATION_Handle *cfg,
357                  GNUNET_TRANSPORT_ATS_AllocationNotification alloc_cb,
358                  void *alloc_cb_cls)
359 {
360   struct GNUNET_ATS_Handle *atc;
361
362   atc = GNUNET_malloc (sizeof (struct GNUNET_ATS_Handle));
363   atc->cfg = cfg;
364   atc->alloc_cb = alloc_cb;
365   atc->alloc_cb_cls = alloc_cb_cls;
366   atc->peers = GNUNET_CONTAINER_multihashmap_create (256);
367   atc->notify_map = GNUNET_CONTAINER_multihashmap_create (256);
368   GNUNET_CONFIGURATION_get_value_number (cfg, "core", "TOTAL_QUOTA_OUT",
369                                          &atc->total_bps);
370   return atc;
371 }
372
373
374 /**
375  * Free an allocation record.
376  *
377  * @param cls unused
378  * @param key identity of the peer associated with the record
379  * @param value the 'struct AllocationRecord' to free
380  * @return GNUNET_OK (continue to iterate)
381  */
382 static int
383 destroy_allocation_record (void *cls, const GNUNET_HashCode * key, void *value)
384 {
385   struct AllocationRecord *ar = value;
386
387   GNUNET_array_grow (ar->ats, ar->ats_count, 0);
388   GNUNET_free (ar->plugin_name);
389   GNUNET_free (ar);
390   return GNUNET_OK;
391 }
392
393
394 /**
395  * Shutdown the ATS subsystem.
396  *
397  * @param atc handle
398  */
399 void
400 GNUNET_ATS_shutdown (struct GNUNET_ATS_Handle *atc)
401 {
402   if (GNUNET_SCHEDULER_NO_TASK != atc->ba_task)
403   {
404     GNUNET_SCHEDULER_cancel (atc->ba_task);
405     atc->ba_task = GNUNET_SCHEDULER_NO_TASK;
406   }
407   GNUNET_CONTAINER_multihashmap_iterate (atc->peers, &destroy_allocation_record,
408                                          NULL);
409   GNUNET_CONTAINER_multihashmap_destroy (atc->peers);
410   GNUNET_assert (GNUNET_CONTAINER_multihashmap_size (atc->notify_map) == 0);
411   GNUNET_CONTAINER_multihashmap_destroy (atc->notify_map);
412   atc->notify_map = NULL;
413   GNUNET_free (atc);
414 }
415
416
417 /**
418  * Closure for 'update_session'
419  */
420 struct UpdateSessionContext
421 {
422   /**
423    * Ats handle.
424    */
425   struct GNUNET_ATS_Handle *atc;
426
427   /**
428    * Allocation record with new information.
429    */
430   struct AllocationRecord *arnew;
431 };
432
433
434 /**
435  * Update an allocation record, merging with the new information
436  *
437  * @param cls a new 'struct AllocationRecord'
438  * @param key identity of the peer associated with the records
439  * @param value the old 'struct AllocationRecord' 
440  * @return GNUNET_YES if the records do not match, 
441  *         GNUNET_NO if the record do match and 'old' was updated
442  */
443 static int
444 update_session (void *cls, const GNUNET_HashCode * key, void *value)
445 {
446   struct UpdateSessionContext *usc = cls;
447   struct AllocationRecord *arnew = usc->arnew;
448   struct AllocationRecord *arold = value;
449   int change;
450
451   if (0 != strcmp (arnew->plugin_name, arold->plugin_name))
452     return GNUNET_YES;
453   if ((arnew->session == arold->session) ||
454       ((arold->session == NULL) &&
455        (arold->plugin_addr_len == arnew->plugin_addr_len) &&
456        (0 ==
457         memcmp (arold->plugin_addr, arnew->plugin_addr,
458                 arnew->plugin_addr_len))))
459   {
460     change = GNUNET_NO;
461     /* records match */
462     if (arnew->session != arold->session)
463     {
464       arold->session = arnew->session;
465       change = GNUNET_YES;
466     }
467     if ((arnew->connected == GNUNET_YES) && (arold->connected == GNUNET_NO))
468     {
469       arold->connected = GNUNET_YES;
470       change = GNUNET_YES;
471     }
472     // FIXME: merge ats arrays of (arold, arnew);
473
474     if (GNUNET_YES == change)
475       update_bandwidth_assignment (usc->atc, arold);
476     return GNUNET_NO;
477   }
478   return GNUNET_YES;
479 }
480
481
482 /**
483  * Create an allocation record with the given properties.
484  *
485  * @param plugin_name name of the currently used transport plugin
486  * @param session session in use (if available)
487  * @param plugin_addr address in use (if available)
488  * @param plugin_addr_len number of bytes in plugin_addr
489  * @param ats performance data for the connection
490  * @param ats_count number of performance records in 'ats'
491  */
492 static struct AllocationRecord *
493 create_allocation_record (const char *plugin_name, struct Session *session,
494                           const void *plugin_addr, size_t plugin_addr_len,
495                           const struct GNUNET_TRANSPORT_ATS_Information *ats,
496                           uint32_t ats_count)
497 {
498   struct AllocationRecord *ar;
499
500   ar = GNUNET_malloc (sizeof (struct AllocationRecord) + plugin_addr_len);
501   ar->plugin_name = GNUNET_strdup (plugin_name);
502   ar->plugin_addr = &ar[1];
503   memcpy (&ar[1], plugin_addr, plugin_addr_len);
504   ar->session = session;
505   ar->plugin_addr_len = plugin_addr_len;
506   GNUNET_array_grow (ar->ats, ar->ats_count, ats_count);
507   memcpy (ar->ats, ats,
508           ats_count * sizeof (struct GNUNET_TRANSPORT_ATS_Information));
509   return ar;
510 }
511
512
513 /**
514  * Mark all matching allocation records as not connected.
515  *
516  * @param cls 'struct GTS_AtsHandle'
517  * @param key identity of the peer associated with the record
518  * @param value the 'struct AllocationRecord' to clear the 'connected' flag
519  * @return GNUNET_OK (continue to iterate)
520  */
521 static int
522 disconnect_peer (void *cls, const GNUNET_HashCode * key, void *value)
523 {
524   struct GNUNET_ATS_Handle *atc = cls;
525   struct AllocationRecord *ar = value;
526
527   if (GNUNET_YES == ar->connected)
528   {
529     ar->connected = GNUNET_NO;
530     update_bandwidth_assignment (atc, ar);
531   }
532   return GNUNET_OK;
533 }
534
535
536 /**
537  * We established a new connection with a peer (for example, because
538  * core asked for it or because the other peer connected to us).
539  * Calculate bandwidth assignments including the new peer.
540  *
541  * @param atc handle
542  * @param peer identity of the new peer
543  * @param plugin_name name of the currently used transport plugin
544  * @param session session in use (if available)
545  * @param plugin_addr address in use (if available)
546  * @param plugin_addr_len number of bytes in plugin_addr
547  * @param ats performance data for the connection
548  * @param ats_count number of performance records in 'ats'
549  */
550 void
551 GNUNET_ATS_peer_connect (struct GNUNET_ATS_Handle *atc,
552                          const struct GNUNET_PeerIdentity *peer,
553                          const char *plugin_name, struct Session *session,
554                          const void *plugin_addr, size_t plugin_addr_len,
555                          const struct GNUNET_TRANSPORT_ATS_Information *ats,
556                          uint32_t ats_count)
557 {
558   struct AllocationRecord *ar;
559   struct UpdateSessionContext usc;
560
561   (void) GNUNET_CONTAINER_multihashmap_iterate (atc->peers, &disconnect_peer,
562                                                 atc);
563   ar = create_allocation_record (plugin_name, session, plugin_addr,
564                                  plugin_addr_len, ats, ats_count);
565   ar->connected = GNUNET_YES;
566   usc.atc = atc;
567   usc.arnew = ar;
568   if (GNUNET_SYSERR ==
569       GNUNET_CONTAINER_multihashmap_iterate (atc->peers, &update_session, &usc))
570   {
571     destroy_allocation_record (NULL, &peer->hashPubKey, ar);
572     return;
573   }
574   GNUNET_assert (GNUNET_OK ==
575                  GNUNET_CONTAINER_multihashmap_put (atc->peers,
576                                                     &peer->hashPubKey, ar,
577                                                     GNUNET_CONTAINER_MULTIHASHMAPOPTION_MULTIPLE));
578 }
579
580
581 /**
582  * We disconnected from the given peer (for example, because ats, core
583  * or blacklist asked for it or because the other peer disconnected).
584  * Calculate bandwidth assignments without the peer.
585  *
586  * @param atc handle
587  * @param peer identity of the new peer
588  */
589 void
590 GNUNET_ATS_peer_disconnect (struct GNUNET_ATS_Handle *atc,
591                             const struct GNUNET_PeerIdentity *peer)
592 {
593   (void) GNUNET_CONTAINER_multihashmap_get_multiple (atc->peers,
594                                                      &peer->hashPubKey,
595                                                      &disconnect_peer, atc);
596 }
597
598
599 /**
600  * Closure for 'destroy_allocation_record'
601  */
602 struct SessionDestroyContext
603 {
604   /**
605    * Ats handle.
606    */
607   struct GNUNET_ATS_Handle *atc;
608
609   /**
610    * Session being destroyed.
611    */
612   const struct Session *session;
613 };
614
615
616 /**
617  * Free an allocation record matching the given session.
618  *
619  * @param cls the 'struct SessionDestroyContext'
620  * @param key identity of the peer associated with the record
621  * @param value the 'struct AllocationRecord' to free
622  * @return GNUNET_OK (continue to iterate)
623  */
624 static int
625 destroy_session (void *cls, const GNUNET_HashCode * key, void *value)
626 {
627   struct SessionDestroyContext *sdc = cls;
628   struct AllocationRecord *ar = value;
629
630   if (ar->session != sdc->session)
631     return GNUNET_OK;
632   ar->session = NULL;
633   if (ar->plugin_addr != NULL)
634     return GNUNET_OK;
635   GNUNET_assert (GNUNET_OK ==
636                  GNUNET_CONTAINER_multihashmap_remove (sdc->atc->peers, key,
637                                                        ar));
638   if (GNUNET_YES == ar->connected) ;
639   {
640     /* FIXME: is this supposed to be allowed? What to do then? */
641     GNUNET_break (0);
642   }
643   destroy_allocation_record (NULL, key, ar);
644   return GNUNET_OK;
645 }
646
647
648 /**
649  * A session got destroyed, stop including it as a valid address.
650  *
651  * @param atc handle
652  * @param peer identity of the peer
653  * @param session session handle that is no longer valid
654  */
655 void
656 GNUNET_ATS_session_destroyed (struct GNUNET_ATS_Handle *atc,
657                               const struct GNUNET_PeerIdentity *peer,
658                               const struct Session *session)
659 {
660   struct SessionDestroyContext sdc;
661
662   sdc.atc = atc;
663   sdc.session = session;
664   (void) GNUNET_CONTAINER_multihashmap_iterate (atc->peers, &destroy_session,
665                                                 &sdc);
666 }
667
668
669 /**
670  * Notify validation watcher that an entry is now valid
671  *
672  * @param cls 'struct ValidationEntry' that is now valid
673  * @param key peer identity (unused)
674  * @param value a 'GST_ValidationIteratorContext' to notify
675  * @return GNUNET_YES (continue to iterate)
676  */
677 static int
678 notify_valid (void *cls, const GNUNET_HashCode * key, void *value)
679 {
680   struct AllocationRecord *ar = cls;
681   struct GNUNET_ATS_SuggestionContext *asc = value;
682
683   asc->cb (asc->cb_cls, &asc->target, ar->plugin_name, ar->plugin_addr,
684            ar->plugin_addr_len,
685            GNUNET_BANDWIDTH_value_init (asc->atc->total_bps / 32), ar->ats,
686            ar->ats_count);
687   GNUNET_ATS_suggest_address_cancel (asc);
688   return GNUNET_OK;
689 }
690
691
692 /**
693  * We have updated performance statistics for a given address.  Note
694  * that this function can be called for addresses that are currently
695  * in use as well as addresses that are valid but not actively in use.
696  * Furthermore, the peer may not even be connected to us right now (in
697  * which case the call may be ignored or the information may be stored
698  * for later use).  Update bandwidth assignments.
699  *
700  * @param atc handle
701  * @param peer identity of the peer
702  * @param valid_until how long is the address valid?
703  * @param plugin_name name of the transport plugin
704  * @param session session handle (if available)
705  * @param plugin_addr address  (if available)
706  * @param plugin_addr_len number of bytes in plugin_addr
707  * @param ats performance data for the address
708  * @param ats_count number of performance records in 'ats'
709  */
710 void
711 GNUNET_ATS_address_update (struct GNUNET_ATS_Handle *atc,
712                            const struct GNUNET_PeerIdentity *peer,
713                            struct GNUNET_TIME_Absolute valid_until,
714                            const char *plugin_name, struct Session *session,
715                            const void *plugin_addr, size_t plugin_addr_len,
716                            const struct GNUNET_TRANSPORT_ATS_Information *ats,
717                            uint32_t ats_count)
718 {
719   struct AllocationRecord *ar;
720   struct UpdateSessionContext usc;
721
722   ar = create_allocation_record (plugin_name, session, plugin_addr,
723                                  plugin_addr_len, ats, ats_count);
724   usc.atc = atc;
725   usc.arnew = ar;
726   if (GNUNET_SYSERR ==
727       GNUNET_CONTAINER_multihashmap_iterate (atc->peers, &update_session, &usc))
728   {
729     destroy_allocation_record (NULL, &peer->hashPubKey, ar);
730     return;
731   }
732   GNUNET_assert (GNUNET_OK ==
733                  GNUNET_CONTAINER_multihashmap_put (atc->peers,
734                                                     &peer->hashPubKey, ar,
735                                                     GNUNET_CONTAINER_MULTIHASHMAPOPTION_MULTIPLE));
736   GNUNET_CONTAINER_multihashmap_get_multiple (atc->notify_map,
737                                               &peer->hashPubKey, &notify_valid,
738                                               ar);
739 }
740
741 /* end of file gnunet-service-transport_ats.c */