From 8ca414e31279a0d559c63f94e31113a9a225380f Mon Sep 17 00:00:00 2001 From: XeonSquared Date: Tue, 23 Jul 2019 14:10:45 +1000 Subject: [PATCH] updated to comply with some of the more recent minitel changes --- service/minitel.lua | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/service/minitel.lua b/service/minitel.lua index 8a1817f..fb3a52c 100644 --- a/service/minitel.lua +++ b/service/minitel.lua @@ -78,7 +78,6 @@ end local function loadconfig() hostname = os.getenv("HOSTNAME") or computer.address():sub(1,8) if OPENOS or PSYCHOS then - print("Opening hostname file.",hnpath) local f,g=io.open(hnpath,"rb") if f then hostname = f:read("*a"):match("(.-)\n") @@ -166,7 +165,7 @@ function start() return npID end - local function sendPacket(packetID,packetType,dest,sender,vPort,data) + local function sendPacket(packetID,packetType,dest,sender,vPort,data,repeatingFrom) if rcache[dest] then dprint("Cached", rcache[dest][1],"send",rcache[dest][2],cfg.port,packetID,packetType,dest,sender,vPort,data) if component.type(rcache[dest][1]) == "modem" then @@ -176,11 +175,13 @@ function start() end else dprint("Not cached", cfg.port,packetID,packetType,dest,sender,vPort,data) - for k,v in pairs(modems) do - if v.type == "modem" then - v.broadcast(cfg.port,packetID,packetType,dest,sender,vPort,data) - elseif v.type == "tunnel" then - v.send(packetID,packetType,dest,sender,vPort,data) + if v.address ~= repeatingFrom or (v.type ~= "tunnel" and v.isWireless()) then + for k,v in pairs(modems) do + if v.type == "modem" then + v.broadcast(cfg.port,packetID,packetType,dest,sender,vPort,data) + elseif v.type == "tunnel" then + v.send(packetID,packetType,dest,sender,vPort,data) + end end end end @@ -231,7 +232,7 @@ function start() elseif dest:sub(1,1) == "~" then -- broadcasts start with ~ computer.pushSignal("net_broadcast",sender,vPort,data) elseif cfg.route then -- repeat packets if route is enabled - sendPacket(packetID,packetType,dest,sender,vPort,data) + sendPacket(packetID,packetType,dest,sender,vPort,data,localModem) end if not rcache[sender] then -- add the sender to the rcache dprint("rcache: "..sender..":", localModem,from,computer.uptime())