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)))
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)))
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));
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)
GNUNET_break (0);
return;
}
+
p = GNUNET_malloc (sizeof (struct PendingMessage) + msize);
p->size = msize;
p->is_init = GNUNET_NO;
GNUNET_break (0);
return;
}
+
p = GNUNET_malloc (sizeof (struct PendingMessage) + msize);
p->size = msize;
p->is_init = GNUNET_NO;
GNUNET_break (0);
return;
}
+
+
p = GNUNET_malloc (sizeof (struct PendingMessage) + msize);
p->size = msize;
p->is_init = GNUNET_NO;
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);