-LRN: Mark session as completely disconnected later.
authorChristian Grothoff <christian@grothoff.org>
Fri, 22 Jun 2012 17:14:25 +0000 (17:14 +0000)
committerChristian Grothoff <christian@grothoff.org>
Fri, 22 Jun 2012 17:14:25 +0000 (17:14 +0000)
  free_neighbour() calls plugin's disconnect() routine, which will invoke
environment session free callback, which will do NOTHING if session is
in "completely disconnected" state (in just "disconnected" state it
will free primary address).

Destroy address in free_address() to make ATS forget the session.

Fixes #2446

src/transport/gnunet-service-transport_neighbours.c

index 02f4e43d1b4b167c060eabd8c64f1c5cbbf9af21..918299feff94aac2a069d28258e86d74d20bd014 100644 (file)
@@ -768,6 +768,14 @@ free_address (struct NeighbourAddress *na)
     GNUNET_ATS_address_in_use (GST_ats, na->address, na->session, GNUNET_NO);
     GNUNET_ATS_address_destroyed (GST_ats, na->address, na->session);
   }
+  else
+  {
+    if (NULL != na->address)
+    {
+      GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "HACK: destroy address\n");
+      GNUNET_ATS_address_destroyed (GST_ats, na->address, na->session);
+    }
+  }
   na->ats_active = GNUNET_NO;
   if (NULL != na->address)
   {
@@ -2497,8 +2505,8 @@ master_task (void *cls,
     GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
                "Cleaning up connection to `%s' after sending DISCONNECT\n",
                GNUNET_i2s (&n->id));
-    n->state = S_DISCONNECT_FINISHED;
     free_neighbour (n, GNUNET_NO);
+    n->state = S_DISCONNECT_FINISHED;
     return;
   case S_DISCONNECT_FINISHED:
     /* how did we get here!? */