*/
unsigned int join(node_t node, unsigned int id_known)
{
- answer_t node_list;
+ const s_answer_t* node_list;
msg_error_t status;
unsigned int trial = 0;
unsigned int i;
XBT_DEBUG("Received an answer from the node I know.");
answer_got = 1;
//retrieve the node list and ping them.
- task_data_t data = MSG_task_get_data(node->task_received);
+ const s_task_data_t* data = MSG_task_get_data(node->task_received);
xbt_assert((data != NULL), "Null data received");
if (data->type == TASK_FIND_NODE_ANSWER) {
node_contact_t contact;
if (status == MSG_OK) {
xbt_assert((node->task_received != NULL), "Invalid task received");
//Figure out if we received an answer or something else
- task_data_t data = MSG_task_get_data(node->task_received);
+ const s_task_data_t* data = MSG_task_get_data(node->task_received);
xbt_assert((data != NULL), "No data in the task");
//Check if what we have received is what we are looking for.
void random_lookup(node_t node)
{
unsigned int id_to_look = RANDOM_LOOKUP_NODE; //Totally random.
- /* TODO: Use some pseudorandom generator like RngStream. */
+ /* TODO: Use some pseudorandom generator. */
XBT_DEBUG("I'm doing a random lookup");
find_node(node, id_to_look, 1);
}
* Sends to the best "KADEMLIA_ALPHA" nodes in the "node_list" array a "FIND_NODE" request, to ask them for their best
* nodes
*/
-unsigned int send_find_node_to_best(node_t node, answer_t node_list)
+unsigned int send_find_node_to_best(node_t node, const_answer_t node_list)
{
unsigned int i = 0;
unsigned int j = 0;
while (j < KADEMLIA_ALPHA && i < node_list->size) {
/* We need to have at most "KADEMLIA_ALPHA" requests each time, according to the protocol */
/* Gets the node we want to send the query to */
- node_contact_t node_to_query = xbt_dynar_get_as(node_list->nodes, i, node_contact_t);
+ const s_node_contact_t* node_to_query = xbt_dynar_get_as(node_list->nodes, i, node_contact_t);
if (node_to_query->id != node->id) { /* No need to query ourselves */
send_find_node(node, node_to_query->id, destination);
j++;
}
/** @brief Handles the answer to an incoming "find_node" task */
-void handle_find_node(node_t node, task_data_t data)
+void handle_find_node(node_t node, const_task_data_t data)
{
XBT_VERB("Received a FIND_NODE from %s (%s), he's trying to find %08x",
data->answer_to, data->issuer_host_name, data->destination_id);