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