public override void Execute(Node localNode) { try { // Failed to send the message. Try routing again. retryCount++; if (!msg.Cancelled) { // Find the next hop for this message nextHop = msg.GetNextHop(localNode); // el numero de saltos está limitado if (nextHop == localNode.localBind) { // Message has arrived at its destination msg.MessageArrivedHook(localNode); } else if (nextHop != null) { // Send on to next hop var cb = new RouteContCallback(Callback); localNode.SendMessageAsync(nextHop, msg, cb); } else { msg.Dispose(); } } } catch (Exception err) { msg.MessageSourceHook(localNode, err); } }
//********************************************************************************************** // Replies //********************************************************************************************** /// <summary> /// Add a reply to the table. /// </summary> public void AddReply(NodeBind dest, OverlayReply reply) { // Get the table entry for this request nodeId (which should already exist) string id = reply.RequestId; if (table.ContainsKey(id)) { // Stick this reply into the table entry TableEntry entry = (TableEntry)table[id]; Debug.Assert(entry.reply == null); entry.reply = reply; entry.replyDest = dest; // la variable q dice si la entrada se ha insertado o no // se marca cuando sale el mensaje; si el mensaje se envia // al mismo nodo del que salio esta varible es igual a true // por lo que no debemos borrar la entrada por que se necesita // para recibir la replica if (!entry.insertedTable) { // cancelamos el timer localNode.CancelTimer(entry.gcTimer); // sino la eliminamos aqui habría que esperar al GC // porque si el mismo nodo nos quiere enviar peticiones // coincidirian con nodeId de peticiones anteriores RemoveEntry(id); } } else { // No entry in the table. // This can occur if AllowDupCCR / AllowDupAD are true // Don't keep track of the reply } }
public override void NeighbourRemoved(NodeBind nodeBind, bool failure) { }
public override void NewNeighbour(NodeBind nodeBind) { }