gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[GNUnet-SVN] r18054 - gnunet/src/ats


From: gnunet
Subject: [GNUnet-SVN] r18054 - gnunet/src/ats
Date: Tue, 8 Nov 2011 18:32:06 +0100

Author: wachs
Date: 2011-11-08 18:32:06 +0100 (Tue, 08 Nov 2011)
New Revision: 18054

Modified:
   gnunet/src/ats/ats_api_scheduling.c
Log:
ATS suggests sessions that we in between terminated from transport
This causes:

0001863  Assertion failed at ats_api_scheduling.c:289.  
0001868 plugins given sometimes an emtpy address in combination with 'force 
address' 
-> session was an inbound session
0001890 Crash during mesh small unicast test (i think)




Modified: gnunet/src/ats/ats_api_scheduling.c
===================================================================
--- gnunet/src/ats/ats_api_scheduling.c 2011-11-08 14:59:46 UTC (rev 18053)
+++ gnunet/src/ats/ats_api_scheduling.c 2011-11-08 17:32:06 UTC (rev 18054)
@@ -290,8 +290,18 @@
     GNUNET_break (0);
     return NULL;
   }
-  if (session_id == 0)
+  /* Check if this session was:
+   *  removed by remove_session (transport service)
+   *  released by release_session (ATS)
+   *  */
+  if (sh->session_array[session_id].session == NULL)
+  {
+    GNUNET_assert (0 ==
+        memcmp (peer, &sh->session_array[session_id].peer,
+                sizeof (struct GNUNET_PeerIdentity)));
     return NULL;
+  }
+
   if (0 !=
       memcmp (peer, &sh->session_array[session_id].peer,
               sizeof (struct GNUNET_PeerIdentity)))
@@ -390,6 +400,10 @@
     sh->reconnect = GNUNET_YES;
     return;
   }
+
+  /* this slot should have been removed from remove_session before */
+  GNUNET_assert (sh->session_array[session_id].session == NULL);
+
   if (0 !=
       memcmp (peer, &sh->session_array[session_id].peer,
               sizeof (struct GNUNET_PeerIdentity)))
@@ -398,6 +412,7 @@
     sh->reconnect = GNUNET_YES;
     return;
   }
+
   sh->session_array[session_id].slot_used = GNUNET_NO;
   memset (&sh->session_array[session_id].peer, 0,
           sizeof (struct GNUNET_PeerIdentity));
@@ -471,10 +486,28 @@
     force_reconnect (sh);
     return;
   }
+  uint32_t session_id =  ntohl (m->session_id);
+
+  struct Session * s = NULL;
+  if (session_id == 0)
+    s = NULL;
+  else
+  {
+    s = find_session (sh, session_id, &m->peer);
+    if (s == NULL)
+    {
+      GNUNET_log (GNUNET_ERROR_TYPE_WARNING, "ATS tries to use outdated 
session `%s'\n", GNUNET_i2s(&m->peer));
+      GNUNET_break (0);
+    }
+  }
+
   sh->suggest_cb (sh->suggest_cb_cls, &m->peer, plugin_name, address,
-                  address_length, find_session (sh, ntohl (m->session_id),
-                                                &m->peer), m->bandwidth_out,
+                  address_length, s, m->bandwidth_out,
                   m->bandwidth_in, atsi, ats_count);
+
+
+
+
   GNUNET_CLIENT_receive (sh->client, &process_ats_message, sh,
                          GNUNET_TIME_UNIT_FOREVER_REL);
   if (GNUNET_YES == sh->reconnect)
@@ -640,6 +673,7 @@
     GNUNET_break (0);
     return;
   }
+
   p = GNUNET_malloc (sizeof (struct PendingMessage) + msize);
   p->size = msize;
   p->is_init = GNUNET_NO;
@@ -695,6 +729,7 @@
     GNUNET_break (0);
     return;
   }
+
   p = GNUNET_malloc (sizeof (struct PendingMessage) + msize);
   p->size = msize;
   p->is_init = GNUNET_NO;
@@ -746,6 +781,8 @@
     GNUNET_break (0);
     return;
   }
+
+
   p = GNUNET_malloc (sizeof (struct PendingMessage) + msize);
   p->size = msize;
   p->is_init = GNUNET_NO;
@@ -756,7 +793,8 @@
   m->peer = *peer;
   m->address_length = htons (plugin_addr_len);
   m->plugin_name_length = htons (namelen);
-  m->session_id = htonl (session_id = get_session_id (sh, session, peer));
+  session_id = get_session_id (sh, session, peer);
+  m->session_id = htonl (session_id);
   pm = (char *) &m[1];
   memcpy (pm, plugin_addr, plugin_addr_len);
   memcpy (&pm[plugin_addr_len], plugin_name, namelen);




reply via email to

[Prev in Thread] Current Thread [Next in Thread]