fix: close port 0 at correct place

This commit is contained in:
2025-05-06 18:21:01 -03:00
parent d9efbc7536
commit 9fffb25594
+1 -2
View File
@@ -98,9 +98,7 @@ end
-- scan -- scan
function handleScan(keys) function handleScan(keys)
-- to-do: check and maybe inform if turtle is already linked to another host -- to-do: check and maybe inform if turtle is already linked to another host
HOST_CHANNEL = keys.hostChannel HOST_CHANNEL = keys.hostChannel
modem.close(0)
log.info("received scan, host channel assigned to %d, replying...", keys.hostChannel) log.info("received scan, host channel assigned to %d, replying...", keys.hostChannel)
@@ -129,6 +127,7 @@ function handleRegister(keys)
log.info("received register, host assigned channel: %d", keys.turtleChannel) log.info("received register, host assigned channel: %d", keys.turtleChannel)
modem.open(keys.turtleChannel) modem.open(keys.turtleChannel)
modem.close(0)
end end
declareCommandHandler("REGISTER", handleRegister, { ["id"] = "number", ["turtleChannel"] = "number" }) declareCommandHandler("REGISTER", handleRegister, { ["id"] = "number", ["turtleChannel"] = "number" })