Attempt to fix the password prompt, didn't work, added debug lines
This commit is contained in:
44
startup.lua
44
startup.lua
@ -667,46 +667,48 @@ local function handleOutgoingDial()
|
||||
-- Wait briefly for version message and password request from remote gate
|
||||
state.remoteHasComputer = false
|
||||
state.remotePasswordRequired = false
|
||||
local messagesReceived = 0
|
||||
local maxMessages = 2 -- Version + potential password request
|
||||
|
||||
local function WaitForMessages()
|
||||
while messagesReceived < maxMessages do
|
||||
sleep(0.1)
|
||||
end
|
||||
return -1
|
||||
end
|
||||
|
||||
local function CollectMessages()
|
||||
-- Wait up to 3 seconds total for messages
|
||||
sleep(3)
|
||||
return -1
|
||||
end
|
||||
|
||||
-- Collect messages for up to 3 seconds
|
||||
-- Collect messages for up to 2 seconds
|
||||
local startTime = os.clock()
|
||||
while (os.clock() - startTime) < 3 and gate.isStargateConnected() do
|
||||
local lastMessageTime = startTime
|
||||
while (os.clock() - startTime) < 2 and gate.isStargateConnected() do
|
||||
local result = parallel.waitForAny(GetMessage, function()
|
||||
sleep(0.1); return -1
|
||||
sleep(0.3); return -1
|
||||
end)
|
||||
if result == 1 then
|
||||
local message = state.lastReceivedMessage
|
||||
state.lastReceivedMessage = nil
|
||||
|
||||
-- DEBUG: Print all messages received
|
||||
print("DEBUG: Message received: " .. tostring(message))
|
||||
utils.log("DEBUG: Message received: " .. tostring(message))
|
||||
|
||||
if message and message:sub(1, 6) == "SGCS_V" then
|
||||
state.remoteHasComputer = true
|
||||
local version = message:sub(7)
|
||||
utils.log("Remote gate has control system version " .. version)
|
||||
messagesReceived = messagesReceived + 1
|
||||
lastMessageTime = os.clock()
|
||||
elseif message == "IRIS_PASSWORD_REQUIRED" then
|
||||
state.remotePasswordRequired = true
|
||||
utils.log("Remote gate requires password for entry")
|
||||
messagesReceived = messagesReceived + 1
|
||||
break -- Got both messages we care about
|
||||
lastMessageTime = os.clock()
|
||||
break -- Got password request, that's all we need
|
||||
end
|
||||
else
|
||||
-- Timeout - if we got a version message, assume no password required
|
||||
if state.remoteHasComputer and (os.clock() - lastMessageTime) > 0.5 then
|
||||
print("DEBUG: Breaking - got version, no password request after 0.5s")
|
||||
break -- No more messages coming
|
||||
elseif not state.remoteHasComputer and (os.clock() - startTime) > 1 then
|
||||
print("DEBUG: Breaking - no version message after 1s")
|
||||
break -- No computer at remote gate
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
print("DEBUG: Message collection complete. remoteHasComputer=" ..
|
||||
tostring(state.remoteHasComputer) .. ", remotePasswordRequired=" .. tostring(state.remotePasswordRequired))
|
||||
|
||||
-- Check if remote iris is closed using transceiver
|
||||
local remoteIrisState = nil
|
||||
if transceiver then
|
||||
|
||||
Reference in New Issue
Block a user