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