From 03f5c34607560d8da7c1750bfcbe8a3182f2e85a Mon Sep 17 00:00:00 2001 From: payonel Date: Wed, 2 Sep 2015 15:14:09 -0700 Subject: [PATCH] move host id initialization to be called once --- src/component/modem.lua | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/component/modem.lua b/src/component/modem.lua index b8f60e3..63da3b6 100644 --- a/src/component/modem.lua +++ b/src/component/modem.lua @@ -189,12 +189,6 @@ function modem_host.dispatchPacket(packet) end function modem_host.processPendingMessages() - -- computer address seems to be applied late - if not modem_host.id then - modem_host.id = component.list("computer",true)() - assert(modem_host.id) - end - -- do not try to process anything if this machine is not even connected to a message board -- not wrong without this, this is a simple optimization if not modem_host.connected then @@ -336,6 +330,12 @@ function modem_host.connectMessageBoard() modem_host.clients = {} modem_host.messages = {} + -- computer address seems to be applied late + if not modem_host.id then + modem_host.id = component.list("computer",true)() + assert(modem_host.id) + end + return true end