updated to comply with some of the more recent minitel changes
This commit is contained in:
parent
2aca6df1b4
commit
8ca414e312
@ -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,6 +175,7 @@ function start()
|
||||
end
|
||||
else
|
||||
dprint("Not cached", cfg.port,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)
|
||||
@ -185,6 +185,7 @@ function start()
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
local function pruneCache()
|
||||
for k,v in pairs(rcache) do
|
||||
@ -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())
|
||||
|
Loading…
Reference in New Issue
Block a user