{
const char *transport_name = cls;
struct GNUNET_HELLO_Address address;
+ int ret;
GNUNET_assert (strlen (transport_name) > 0);
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Session %p to peer `%s' ended \n",
address.address = NULL;
address.address_length = 0;
address.transport_name = transport_name;
- GST_neighbours_session_terminated (peer, session);
- GNUNET_ATS_address_destroyed (GST_ats, &address, session);
+ ret = GST_neighbours_session_terminated (peer, session);
+ if (GNUNET_NO == ret)
+ {
+ /* This was a session currently not used by
+ * neighbours so we have to destroy it here */
+ GNUNET_ATS_address_destroyed (GST_ats, &address, session);
+ }
}
{
GST_validation_set_address_use (na->address, na->session, GNUNET_NO, __LINE__);
GNUNET_ATS_address_in_use (GST_ats, na->address, na->session, GNUNET_NO);
+ GNUNET_ATS_address_destroyed (GST_ats, na->address, na->session);
}
na->ats_active = GNUNET_NO;
if (NULL != na->address)
*
* @param peer identity of the peer where the session died
* @param session session that is gone
+ * @param GNUNET_YES if this was a session used, GNUNET_NO if
+ * this session was not in use
*/
-void
+int
GST_neighbours_session_terminated (const struct GNUNET_PeerIdentity *peer,
struct Session *session)
{
}
}
if (NULL == (n = lookup_neighbour (peer)))
- return; /* can't affect us */
+ return GNUNET_NO; /* can't affect us */
if (session != n->primary_address.session)
{
if (session == n->alternative_address.session)
else
GNUNET_break (0);
}
- return; /* doesn't affect us further */
+ return GNUNET_NO; /* doesn't affect us further */
}
n->expect_latency_response = GNUNET_NO;
case S_NOT_CONNECTED:
GNUNET_break (0);
free_neighbour (n, GNUNET_NO);
- return;
+ return GNUNET_YES;
case S_INIT_ATS:
GNUNET_break (0);
free_neighbour (n, GNUNET_NO);
- return;
+ return GNUNET_YES;
case S_INIT_BLACKLIST:
case S_CONNECT_SENT:
free_address (&n->primary_address);
/* error on inbound session; free neighbour entirely */
free_address (&n->primary_address);
free_neighbour (n, GNUNET_NO);
- return;
+ return GNUNET_YES;
case S_CONNECTED:
free_address (&n->primary_address);
n->state = S_RECONNECT_ATS;
if (GNUNET_SCHEDULER_NO_TASK != n->task)
GNUNET_SCHEDULER_cancel (n->task);
n->task = GNUNET_SCHEDULER_add_now (&master_task, n);
+ return GNUNET_YES;
}
*
* @param peer identity of the peer where the session died
* @param session session that is gone
+ * @param GNUNET_YES if this was a session used, GNUNET_NO if
+ * this session was not in use
*/
-void
+int
GST_neighbours_session_terminated (const struct GNUNET_PeerIdentity *peer,
struct Session *session);