+ if (GNUNET_YES == ai->expired)
+ {
+ /* last reason to keep this 'ai' around is now gone, the
+ session is dead as well, clean up */
+ if (NULL != ai->ar)
+ {
+ /* Address expired but not blocked, and thus 'ar' was still
+ live because of the session; deleting just the session
+ will do for an inbound session, but for an outbound we
+ then also need to destroy the address with ATS. */
+ if (GNUNET_NO ==
+ GNUNET_ATS_address_del_session (ai->ar,
+ session))
+ {
+ GNUNET_ATS_address_destroy (ai->ar);
+ }
+ /* "ar" has been freed, regardless how the branch
+ above played out: it was either freed in
+ #GNUNET_ATS_address_del_session() because it was
+ incoming, or explicitly in
+ #GNUNET_ATS_address_del_session(). */
+ ai->ar = NULL;
+ }
+ destroy_ai (ai);
+ return;
+ }
+