summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMatthias Wachs <wachs@net.in.tum.de>2011-11-11 16:03:28 +0000
committerMatthias Wachs <wachs@net.in.tum.de>2011-11-11 16:03:28 +0000
commitb389970f4d7563721ada3861366d164fcb45031a (patch)
tree7f466cf34e806a9ea8c21135e9970af306677735 /src
parent2b3b24e80a709916fa58914256a3bcef1b623813 (diff)
session pointers can rarely be identical due to timing issues
Diffstat (limited to 'src')
-rw-r--r--src/ats/ats_api_scheduling.c32
1 files changed, 7 insertions, 25 deletions
diff --git a/src/ats/ats_api_scheduling.c b/src/ats/ats_api_scheduling.c
index dd06916a1..663a7925a 100644
--- a/src/ats/ats_api_scheduling.c
+++ b/src/ats/ats_api_scheduling.c
@@ -297,21 +297,8 @@ find_session (struct GNUNET_ATS_SchedulingHandle *sh, uint32_t session_id,
* 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 @@ get_session_id (struct GNUNET_ATS_SchedulingHandle *sh, struct Session *session,
{
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 @@ remove_session (struct GNUNET_ATS_SchedulingHandle *sh, uint32_t session_id,
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 @@ release_session (struct GNUNET_ATS_SchedulingHandle *sh, uint32_t session_id,
/* 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 @@ process_ats_message (void *cls, const struct GNUNET_MessageHeader *msg)
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)