routing fix
This commit is contained in:
@@ -74,7 +74,11 @@ class Routing {
|
||||
data: null
|
||||
}
|
||||
|
||||
interf.send(pack.fromID,Net.instance.networkID,response);
|
||||
// HACK: Because Lua is singelthreaded the computer we respond to can get overwhelmed with
|
||||
// the responses and can swollow events.
|
||||
new Timer(Net.instance.networkID / 3,()->{
|
||||
interf.send(response.toID,Net.instance.networkID,response);
|
||||
});
|
||||
}
|
||||
|
||||
private function genRouteList(): Array<{id:NetworkID,cost:Int}> {
|
||||
@@ -109,18 +113,16 @@ class Routing {
|
||||
return;
|
||||
}
|
||||
|
||||
Log.debug("a");
|
||||
|
||||
var fullCost = cost+interf.getBaseRoutingCost();
|
||||
|
||||
if (this.routingTable.exists(toID)){
|
||||
if (this.routingTable[toID].cost > fullCost){
|
||||
Log.debug("Better route: " + toID + " -> " + interf.name() + ":$"+fullCost);
|
||||
Log.info("Better route: " + toID + " -> " + interf.name() + ":$"+fullCost);
|
||||
this.routingTable[toID] = {interf:interf,cost:cost + interf.getBaseRoutingCost()};
|
||||
}
|
||||
}else{
|
||||
this.routingTable[toID] = {interf:interf,cost:cost + interf.getBaseRoutingCost()};
|
||||
Log.debug("New route: " + toID + " -> " + interf.name() + ":$"+fullCost);
|
||||
Log.info("New route: " + toID + " -> " + interf.name() + ":$"+fullCost);
|
||||
this.onNewNeigborTrigger.trigger(toID);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user