Compare commits

2 Commits
main ... stable

Author SHA1 Message Date
MayaTheShy
9835556e6f diag: add verbose network listener logging to trace command delivery
Manager logs: listener start, every modem_message received, channel
match/mismatch, command acceptance count, handler result.
Client logs: every sendToMaster call with type and commandId.
2026-03-29 16:39:29 -04:00
MayaTheShy
033da0933c fix: point package repository to stable branch 2026-03-29 16:22:25 -04:00
3 changed files with 19 additions and 2 deletions

View File

@@ -1,7 +1,7 @@
{
title = "Inventory Manager",
description = "Automated inventory management system for CC:Tweaked. Tracks items across networked storage, crafting turtles, furnaces, and alerts. Includes web dashboard via bridge computer.",
repository = "gitea://git.spatulaa.com/MayaTheShy/Inventory-Manager-CC/main/",
repository = "gitea://git.spatulaa.com/MayaTheShy/Inventory-Manager-CC/stable/",
exclude = {
"^web/", "^__tests__/", "^startup/",
"%.md$", "%.json$", "^%.git", "^LICENSE$", "^node_modules/",

View File

@@ -105,10 +105,14 @@ end
-------------------------------------------------
local function sendToMaster(message)
if not networkModem then return end
if not networkModem then
log.warn("NET", "sendToMaster: no modem, dropping %s", tostring(message.type))
return
end
if not message.commandId then
message.commandId = newCommandId()
end
log.info("NET", "TX -> ch %d: type=%s cmdId=%s", ORDER_CHANNEL, tostring(message.type), tostring(message.commandId))
networkModem.transmit(ORDER_CHANNEL, CLIENT_CHANNEL, message)
end

View File

@@ -541,14 +541,23 @@ local function main()
-- Task 13: Network order/command listener
function()
if not ctx.networkModem then
log.warn("NET", "No modem — listener disabled")
while true do sleep(3600) end
end
log.info("NET", "Listener started on channel %d (modem: %s)", cfg.ORDER_CHANNEL, ctx.networkModemName or "?")
local cmdCount = 0
while true do
log.info("NET", "Waiting for modem_message... (handled %d so far)", cmdCount)
local event, side, channel, replyChannel, message, distance = os.pullEvent("modem_message")
log.info("NET", "Got modem_message: side=%s ch=%d reply=%d type=%s",
tostring(side), channel or -1, replyChannel or -1,
type(message) == "table" and tostring(message.type) or type(message))
if channel == cfg.ORDER_CHANNEL and type(message) == "table" then
if isCommandDuplicate(message.commandId) then
log.debug("NET", "Duplicate command skipped: %s", tostring(message.commandId))
else
cmdCount = cmdCount + 1
log.info("NET", "Command #%d accepted: type=%s cmdId=%s", cmdCount, tostring(message.type), tostring(message.commandId))
recordCommandId(message.commandId)
cleanupCommandIds()
local handlerOk, handlerErr = pcall(function()
@@ -794,8 +803,12 @@ local function main()
end) -- pcall handler
if not handlerOk then
log.error("NET", "Handler error: %s", tostring(handlerErr))
else
log.info("NET", "Command #%d handled OK", cmdCount)
end
end -- idempotency else
else
log.info("NET", "Ignored: ch=%d (want %d) or not table", channel or -1, cfg.ORDER_CHANNEL)
end
end
end