diff --git a/src/kernel/net/Net.hx b/src/kernel/net/Net.hx index bc7a34d..bf781b2 100644 --- a/src/kernel/net/Net.hx +++ b/src/kernel/net/Net.hx @@ -1,5 +1,7 @@ package kernel.net; +using tink.CoreApi; + import kernel.peripherals.Peripherals.Peripheral; import kernel.Log; import kernel.KernelEvents; @@ -19,8 +21,12 @@ using util.Extender.LambdaExtender; class Net { public static var instance:Net; + public final onNewNeigbor: Signal; + private final onNewNeigborTrigger: SignalTrigger = Signal.trigger(); + @:allow(kernel.Init) private function new() { + onNewNeigbor = onNewNeigborTrigger.asSignal(); KernelEvents.instance.onModemMessage.handle(params -> { var pack:Package = { fromID: params.replyChannel, @@ -108,6 +114,7 @@ class Net { private function addRoute(toID:Int, addr:String) { Log.debug("Added new route to " + toID + " via " + addr); + this.onNewNeigborTrigger.trigger(toID); routingTable.set(toID, allModems.find(item -> item.addr == addr)); }