move host id initialization to be called once

This commit is contained in:
payonel 2015-09-02 15:14:09 -07:00
parent beddf124fc
commit 03f5c34607

View File

@ -189,12 +189,6 @@ function modem_host.dispatchPacket(packet)
end end
function modem_host.processPendingMessages() 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 -- 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 -- not wrong without this, this is a simple optimization
if not modem_host.connected then if not modem_host.connected then
@ -336,6 +330,12 @@ function modem_host.connectMessageBoard()
modem_host.clients = {} modem_host.clients = {}
modem_host.messages = {} 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 return true
end end