gnunet-svn
[Top][All Lists]
Advanced

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

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


From: gnunet
Subject: [GNUnet-SVN] r18106 - gnunet/src/ats
Date: Fri, 11 Nov 2011 17:03:28 +0100

Author: wachs
Date: 2011-11-11 17:03:28 +0100 (Fri, 11 Nov 2011)
New Revision: 18106

Modified:
   gnunet/src/ats/ats_api_scheduling.c
Log:
session pointers can rarely be identical due to timing issues


Modified: gnunet/src/ats/ats_api_scheduling.c
===================================================================
--- gnunet/src/ats/ats_api_scheduling.c 2011-11-11 15:35:05 UTC (rev 18105)
+++ gnunet/src/ats/ats_api_scheduling.c 2011-11-11 16:03:28 UTC (rev 18106)
@@ -297,21 +297,8 @@
    *  released by release_session (ATS)
    *  */
   if (sh->session_array[session_id].session == NULL)
-  {
-    GNUNET_break (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)))
-  {
-    GNUNET_break (0);
-    sh->reconnect = GNUNET_YES;
-    return NULL;
-  }
   return sh->session_array[session_id].session;
 }
 
@@ -339,10 +326,11 @@
   {
     if (session == sh->session_array[i].session)
     {
-      GNUNET_assert (0 ==
-                     memcmp (peer, &sh->session_array[i].peer,
-                             sizeof (struct GNUNET_PeerIdentity)));
-      return i;
+      if (0 !=  memcmp (peer, &sh->session_array[i].peer,
+                             sizeof (struct GNUNET_PeerIdentity)))
+        continue;
+      else
+        return i;
     }
     if ((f == 0) && (sh->session_array[i].slot_used == GNUNET_NO))
       f = i;
@@ -377,8 +365,7 @@
     return;
   GNUNET_assert (session_id < sh->session_array_size);
   GNUNET_assert (GNUNET_YES == sh->session_array[session_id].slot_used);
-  GNUNET_assert (0 ==
-                 memcmp (peer, &sh->session_array[session_id].peer,
+  GNUNET_assert (0 == memcmp (peer, &sh->session_array[session_id].peer,
                          sizeof (struct GNUNET_PeerIdentity)));
   sh->session_array[session_id].session = NULL;
 }
@@ -406,15 +393,13 @@
   /* 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,
+  if (0 != memcmp (peer, &sh->session_array[session_id].peer,
               sizeof (struct GNUNET_PeerIdentity)))
   {
     GNUNET_break (0);
     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));
@@ -511,9 +496,6 @@
   sh->suggest_cb (sh->suggest_cb_cls, &address, 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)




reply via email to

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