Extended ATS and transport service to store session IDs to support inbound sessions
[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            ar->session,
290            GNUNET_BANDWIDTH_value_init (asc->atc->total_bps / 32), ar->ats,
291            ar->ats_count);
292   asc->cb = NULL;
293   return GNUNET_NO;
294 }
295
296
297 /**
298  * We would like to establish a new connection with a peer.
299  * ATS should suggest a good address to begin with.
300  *
301  * @param atc handle
302  * @param peer identity of the new peer
303  * @param cb function to call with the address
304  * @param cb_cls closure for cb
305  */
306 struct GNUNET_ATS_SuggestionContext *
307 GNUNET_ATS_suggest_address (struct GNUNET_ATS_Handle *atc,
308                             const struct GNUNET_PeerIdentity *peer,
309                             GNUNET_ATS_AddressSuggestionCallback cb,
310                             void *cb_cls)
311 {
312   struct GNUNET_ATS_SuggestionContext *asc;
313
314   asc = GNUNET_malloc (sizeof (struct GNUNET_ATS_SuggestionContext));
315   asc->cb = cb;
316   asc->cb_cls = cb_cls;
317   asc->atc = atc;
318   asc->target = *peer;
319   GNUNET_CONTAINER_multihashmap_get_multiple (atc->peers, &peer->hashPubKey,
320                                               &suggest_address, asc);
321   if (NULL == asc->cb)
322   {
323     GNUNET_free (asc);
324     return NULL;
325   }
326   GNUNET_CONTAINER_multihashmap_put (atc->notify_map, &peer->hashPubKey, asc,
327                                      GNUNET_CONTAINER_MULTIHASHMAPOPTION_MULTIPLE);
328   return asc;
329 }
330
331
332 /**
333  * Cancel suggestion request.
334  *
335  * @param asc handle of the request to cancel
336  */
337 void
338 GNUNET_ATS_suggest_address_cancel (struct GNUNET_ATS_SuggestionContext *asc)
339 {
340   GNUNET_assert (GNUNET_OK ==
341                  GNUNET_CONTAINER_multihashmap_remove (asc->atc->notify_map,
342                                                        &asc->target.hashPubKey,
343                                                        asc));
344   GNUNET_free (asc);
345 }
346
347
348 /**
349  * Initialize the ATS subsystem.
350  *
351  * @param cfg configuration to use
352  * @param alloc_cb notification to call whenever the allocation changed
353  * @param alloc_cb_cls closure for 'alloc_cb'
354  * @return ats context
355  */
356 struct GNUNET_ATS_Handle *
357 GNUNET_ATS_init (const struct GNUNET_CONFIGURATION_Handle *cfg,
358                  GNUNET_TRANSPORT_ATS_AllocationNotification alloc_cb,
359                  void *alloc_cb_cls)
360 {
361   struct GNUNET_ATS_Handle *atc;
362
363   atc = GNUNET_malloc (sizeof (struct GNUNET_ATS_Handle));
364   atc->cfg = cfg;
365   atc->alloc_cb = alloc_cb;
366   atc->alloc_cb_cls = alloc_cb_cls;
367   atc->peers = GNUNET_CONTAINER_multihashmap_create (256);
368   atc->notify_map = GNUNET_CONTAINER_multihashmap_create (256);
369   GNUNET_CONFIGURATION_get_value_number (cfg, "core", "TOTAL_QUOTA_OUT",
370                                          &atc->total_bps);
371   return atc;
372 }
373
374
375 /**
376  * Free an allocation record.
377  *
378  * @param cls unused
379  * @param key identity of the peer associated with the record
380  * @param value the 'struct AllocationRecord' to free
381  * @return GNUNET_OK (continue to iterate)
382  */
383 static int
384 destroy_allocation_record (void *cls, const GNUNET_HashCode * key, void *value)
385 {
386   struct AllocationRecord *ar = value;
387
388   GNUNET_array_grow (ar->ats, ar->ats_count, 0);
389   GNUNET_free (ar->plugin_name);
390   GNUNET_free (ar);
391   return GNUNET_OK;
392 }
393
394
395 /**
396  * Shutdown the ATS subsystem.
397  *
398  * @param atc handle
399  */
400 void
401 GNUNET_ATS_shutdown (struct GNUNET_ATS_Handle *atc)
402 {
403   if (GNUNET_SCHEDULER_NO_TASK != atc->ba_task)
404   {
405     GNUNET_SCHEDULER_cancel (atc->ba_task);
406     atc->ba_task = GNUNET_SCHEDULER_NO_TASK;
407   }
408   GNUNET_CONTAINER_multihashmap_iterate (atc->peers, &destroy_allocation_record,
409                                          NULL);
410   GNUNET_CONTAINER_multihashmap_destroy (atc->peers);
411   GNUNET_assert (GNUNET_CONTAINER_multihashmap_size (atc->notify_map) == 0);
412   GNUNET_CONTAINER_multihashmap_destroy (atc->notify_map);
413   atc->notify_map = NULL;
414   GNUNET_free (atc);
415 }
416
417
418 /**
419  * Closure for 'update_session'
420  */
421 struct UpdateSessionContext
422 {
423   /**
424    * Ats handle.
425    */
426   struct GNUNET_ATS_Handle *atc;
427
428   /**
429    * Allocation record with new information.
430    */
431   struct AllocationRecord *arnew;
432 };
433
434
435 /**
436  * Update an allocation record, merging with the new information
437  *
438  * @param cls a new 'struct AllocationRecord'
439  * @param key identity of the peer associated with the records
440  * @param value the old 'struct AllocationRecord' 
441  * @return GNUNET_YES if the records do not match, 
442  *         GNUNET_NO if the record do match and 'old' was updated
443  */
444 static int
445 update_session (void *cls, const GNUNET_HashCode * key, void *value)
446 {
447   struct UpdateSessionContext *usc = cls;
448   struct AllocationRecord *arnew = usc->arnew;
449   struct AllocationRecord *arold = value;
450   int change;
451
452   if (0 != strcmp (arnew->plugin_name, arold->plugin_name))
453     return GNUNET_YES;
454   if ((arnew->session == arold->session) ||
455       ((arold->session == NULL) &&
456        (arold->plugin_addr_len == arnew->plugin_addr_len) &&
457        (0 ==
458         memcmp (arold->plugin_addr, arnew->plugin_addr,
459                 arnew->plugin_addr_len))))
460   {
461     change = GNUNET_NO;
462     /* records match */
463     if (arnew->session != arold->session)
464     {
465       arold->session = arnew->session;
466       change = GNUNET_YES;
467     }
468     if ((arnew->connected == GNUNET_YES) && (arold->connected == GNUNET_NO))
469     {
470       arold->connected = GNUNET_YES;
471       change = GNUNET_YES;
472     }
473     // FIXME: merge ats arrays of (arold, arnew);
474
475     if (GNUNET_YES == change)
476       update_bandwidth_assignment (usc->atc, arold);
477     return GNUNET_NO;
478   }
479   return GNUNET_YES;
480 }
481
482
483 /**
484  * Create an allocation record with the given properties.
485  *
486  * @param plugin_name name of the currently used transport plugin
487  * @param session session in use (if available)
488  * @param plugin_addr address in use (if available)
489  * @param plugin_addr_len number of bytes in plugin_addr
490  * @param ats performance data for the connection
491  * @param ats_count number of performance records in 'ats'
492  */
493 static struct AllocationRecord *
494 create_allocation_record (const char *plugin_name, struct Session *session,
495                           const void *plugin_addr, size_t plugin_addr_len,
496                           const struct GNUNET_TRANSPORT_ATS_Information *ats,
497                           uint32_t ats_count)
498 {
499   struct AllocationRecord *ar;
500
501   ar = GNUNET_malloc (sizeof (struct AllocationRecord) + plugin_addr_len);
502   ar->plugin_name = GNUNET_strdup (plugin_name);
503   ar->plugin_addr = &ar[1];
504   memcpy (&ar[1], plugin_addr, plugin_addr_len);
505   ar->session = session;
506   ar->plugin_addr_len = plugin_addr_len;
507   GNUNET_array_grow (ar->ats, ar->ats_count, ats_count);
508   memcpy (ar->ats, ats,
509           ats_count * sizeof (struct GNUNET_TRANSPORT_ATS_Information));
510   return ar;
511 }
512
513
514 /**
515  * Mark all matching allocation records as not connected.
516  *
517  * @param cls 'struct GTS_AtsHandle'
518  * @param key identity of the peer associated with the record
519  * @param value the 'struct AllocationRecord' to clear the 'connected' flag
520  * @return GNUNET_OK (continue to iterate)
521  */
522 static int
523 disconnect_peer (void *cls, const GNUNET_HashCode * key, void *value)
524 {
525   struct GNUNET_ATS_Handle *atc = cls;
526   struct AllocationRecord *ar = value;
527
528   if (GNUNET_YES == ar->connected)
529   {
530     ar->connected = GNUNET_NO;
531     update_bandwidth_assignment (atc, ar);
532   }
533   return GNUNET_OK;
534 }
535
536
537 /**
538  * We established a new connection with a peer (for example, because
539  * core asked for it or because the other peer connected to us).
540  * Calculate bandwidth assignments including the new peer.
541  *
542  * @param atc handle
543  * @param peer identity of the new peer
544  * @param plugin_name name of the currently used transport plugin
545  * @param session session in use (if available)
546  * @param plugin_addr address in use (if available)
547  * @param plugin_addr_len number of bytes in plugin_addr
548  * @param ats performance data for the connection
549  * @param ats_count number of performance records in 'ats'
550  */
551 void
552 GNUNET_ATS_peer_connect (struct GNUNET_ATS_Handle *atc,
553                          const struct GNUNET_PeerIdentity *peer,
554                          const char *plugin_name, struct Session *session,
555                          const void *plugin_addr, size_t plugin_addr_len,
556                          const struct GNUNET_TRANSPORT_ATS_Information *ats,
557                          uint32_t ats_count)
558 {
559   struct AllocationRecord *ar;
560   struct UpdateSessionContext usc;
561
562   (void) GNUNET_CONTAINER_multihashmap_iterate (atc->peers, &disconnect_peer,
563                                                 atc);
564   ar = create_allocation_record (plugin_name, session, plugin_addr,
565                                  plugin_addr_len, ats, ats_count);
566   ar->connected = GNUNET_YES;
567   usc.atc = atc;
568   usc.arnew = ar;
569   if (GNUNET_SYSERR ==
570       GNUNET_CONTAINER_multihashmap_iterate (atc->peers, &update_session, &usc))
571   {
572     destroy_allocation_record (NULL, &peer->hashPubKey, ar);
573     return;
574   }
575   GNUNET_assert (GNUNET_OK ==
576                  GNUNET_CONTAINER_multihashmap_put (atc->peers,
577                                                     &peer->hashPubKey, ar,
578                                                     GNUNET_CONTAINER_MULTIHASHMAPOPTION_MULTIPLE));
579 }
580
581
582 /**
583  * We disconnected from the given peer (for example, because ats, core
584  * or blacklist asked for it or because the other peer disconnected).
585  * Calculate bandwidth assignments without the peer.
586  *
587  * @param atc handle
588  * @param peer identity of the new peer
589  */
590 void
591 GNUNET_ATS_peer_disconnect (struct GNUNET_ATS_Handle *atc,
592                             const struct GNUNET_PeerIdentity *peer)
593 {
594   (void) GNUNET_CONTAINER_multihashmap_get_multiple (atc->peers,
595                                                      &peer->hashPubKey,
596                                                      &disconnect_peer, atc);
597 }
598
599
600 /**
601  * Closure for 'destroy_allocation_record'
602  */
603 struct SessionDestroyContext
604 {
605   /**
606    * Ats handle.
607    */
608   struct GNUNET_ATS_Handle *atc;
609
610   /**
611    * Session being destroyed.
612    */
613   const struct Session *session;
614 };
615
616
617 /**
618  * Free an allocation record matching the given session.
619  *
620  * @param cls the 'struct SessionDestroyContext'
621  * @param key identity of the peer associated with the record
622  * @param value the 'struct AllocationRecord' to free
623  * @return GNUNET_OK (continue to iterate)
624  */
625 static int
626 destroy_session (void *cls, const GNUNET_HashCode * key, void *value)
627 {
628   struct SessionDestroyContext *sdc = cls;
629   struct AllocationRecord *ar = value;
630
631   if (ar->session != sdc->session)
632     return GNUNET_OK;
633   ar->session = NULL;
634   if (ar->plugin_addr != NULL)
635     return GNUNET_OK;
636   GNUNET_assert (GNUNET_OK ==
637                  GNUNET_CONTAINER_multihashmap_remove (sdc->atc->peers, key,
638                                                        ar));
639   if (GNUNET_YES == ar->connected) ;
640   {
641     /* FIXME: is this supposed to be allowed? What to do then? */
642     GNUNET_break (0);
643   }
644   destroy_allocation_record (NULL, key, ar);
645   return GNUNET_OK;
646 }
647
648
649 /**
650  * A session got destroyed, stop including it as a valid address.
651  *
652  * @param atc handle
653  * @param peer identity of the peer
654  * @param session session handle that is no longer valid
655  */
656 void
657 GNUNET_ATS_session_destroyed (struct GNUNET_ATS_Handle *atc,
658                               const struct GNUNET_PeerIdentity *peer,
659                               const struct Session *session)
660 {
661   struct SessionDestroyContext sdc;
662
663   sdc.atc = atc;
664   sdc.session = session;
665   (void) GNUNET_CONTAINER_multihashmap_iterate (atc->peers, &destroy_session,
666                                                 &sdc);
667 }
668
669
670 /**
671  * Notify validation watcher that an entry is now valid
672  *
673  * @param cls 'struct ValidationEntry' that is now valid
674  * @param key peer identity (unused)
675  * @param value a 'GST_ValidationIteratorContext' to notify
676  * @return GNUNET_YES (continue to iterate)
677  */
678 static int
679 notify_valid (void *cls, const GNUNET_HashCode * key, void *value)
680 {
681   struct AllocationRecord *ar = cls;
682   struct GNUNET_ATS_SuggestionContext *asc = value;
683
684   asc->cb (asc->cb_cls, &asc->target, ar->plugin_name, ar->plugin_addr,
685            ar->plugin_addr_len,
686            ar->session,
687            GNUNET_BANDWIDTH_value_init (asc->atc->total_bps / 32), ar->ats,
688            ar->ats_count);
689   GNUNET_ATS_suggest_address_cancel (asc);
690   return GNUNET_OK;
691 }
692
693
694 /**
695  * We have updated performance statistics for a given address.  Note
696  * that this function can be called for addresses that are currently
697  * in use as well as addresses that are valid but not actively in use.
698  * Furthermore, the peer may not even be connected to us right now (in
699  * which case the call may be ignored or the information may be stored
700  * for later use).  Update bandwidth assignments.
701  *
702  * @param atc handle
703  * @param peer identity of the peer
704  * @param valid_until how long is the address valid?
705  * @param plugin_name name of the transport plugin
706  * @param session session handle (if available)
707  * @param plugin_addr address  (if available)
708  * @param plugin_addr_len number of bytes in plugin_addr
709  * @param ats performance data for the address
710  * @param ats_count number of performance records in 'ats'
711  */
712 void
713 GNUNET_ATS_address_update (struct GNUNET_ATS_Handle *atc,
714                            const struct GNUNET_PeerIdentity *peer,
715                            struct GNUNET_TIME_Absolute valid_until,
716                            const char *plugin_name, struct Session *session,
717                            const void *plugin_addr, size_t plugin_addr_len,
718                            const struct GNUNET_TRANSPORT_ATS_Information *ats,
719                            uint32_t ats_count)
720 {
721   struct AllocationRecord *ar;
722   struct UpdateSessionContext usc;
723
724   ar = create_allocation_record (plugin_name, session, plugin_addr,
725                                  plugin_addr_len, ats, ats_count);
726   usc.atc = atc;
727   usc.arnew = ar;
728   if (GNUNET_SYSERR ==
729       GNUNET_CONTAINER_multihashmap_iterate (atc->peers, &update_session, &usc))
730   {
731     destroy_allocation_record (NULL, &peer->hashPubKey, ar);
732     return;
733   }
734   GNUNET_assert (GNUNET_OK ==
735                  GNUNET_CONTAINER_multihashmap_put (atc->peers,
736                                                     &peer->hashPubKey, ar,
737                                                     GNUNET_CONTAINER_MULTIHASHMAPOPTION_MULTIPLE));
738   GNUNET_CONTAINER_multihashmap_get_multiple (atc->notify_map,
739                                               &peer->hashPubKey, &notify_valid,
740                                               ar);
741 }
742
743 /* end of file gnunet-service-transport_ats.c */