Attempt to fix the password prompt, didn't work, added debug lines

This commit is contained in:
2026-01-01 22:52:28 -05:00
parent 7684cccf13
commit ed517502e2

View File

@ -667,46 +667,48 @@ local function handleOutgoingDial()
-- Wait briefly for version message and password request from remote gate -- Wait briefly for version message and password request from remote gate
state.remoteHasComputer = false state.remoteHasComputer = false
state.remotePasswordRequired = false state.remotePasswordRequired = false
local messagesReceived = 0
local maxMessages = 2 -- Version + potential password request
local function WaitForMessages() -- Collect messages for up to 2 seconds
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
local startTime = os.clock() 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() local result = parallel.waitForAny(GetMessage, function()
sleep(0.1); return -1 sleep(0.3); return -1
end) end)
if result == 1 then if result == 1 then
local message = state.lastReceivedMessage local message = state.lastReceivedMessage
state.lastReceivedMessage = nil 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 if message and message:sub(1, 6) == "SGCS_V" then
state.remoteHasComputer = true state.remoteHasComputer = true
local version = message:sub(7) local version = message:sub(7)
utils.log("Remote gate has control system version " .. version) utils.log("Remote gate has control system version " .. version)
messagesReceived = messagesReceived + 1 lastMessageTime = os.clock()
elseif message == "IRIS_PASSWORD_REQUIRED" then elseif message == "IRIS_PASSWORD_REQUIRED" then
state.remotePasswordRequired = true state.remotePasswordRequired = true
utils.log("Remote gate requires password for entry") utils.log("Remote gate requires password for entry")
messagesReceived = messagesReceived + 1 lastMessageTime = os.clock()
break -- Got both messages we care about 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 end
end end
print("DEBUG: Message collection complete. remoteHasComputer=" ..
tostring(state.remoteHasComputer) .. ", remotePasswordRequired=" .. tostring(state.remotePasswordRequired))
-- Check if remote iris is closed using transceiver -- Check if remote iris is closed using transceiver
local remoteIrisState = nil local remoteIrisState = nil
if transceiver then if transceiver then