mirror of
https://git.shadowkat.net/izaya/OC-PsychOS2.git
synced 2024-11-22 12:04:20 -05:00
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()
|
local function loadconfig()
|
||||||
hostname = os.getenv("HOSTNAME") or computer.address():sub(1,8)
|
hostname = os.getenv("HOSTNAME") or computer.address():sub(1,8)
|
||||||
if OPENOS or PSYCHOS then
|
if OPENOS or PSYCHOS then
|
||||||
print("Opening hostname file.",hnpath)
|
|
||||||
local f,g=io.open(hnpath,"rb")
|
local f,g=io.open(hnpath,"rb")
|
||||||
if f then
|
if f then
|
||||||
hostname = f:read("*a"):match("(.-)\n")
|
hostname = f:read("*a"):match("(.-)\n")
|
||||||
@ -166,7 +165,7 @@ function start()
|
|||||||
return npID
|
return npID
|
||||||
end
|
end
|
||||||
|
|
||||||
local function sendPacket(packetID,packetType,dest,sender,vPort,data)
|
local function sendPacket(packetID,packetType,dest,sender,vPort,data,repeatingFrom)
|
||||||
if rcache[dest] then
|
if rcache[dest] then
|
||||||
dprint("Cached", rcache[dest][1],"send",rcache[dest][2],cfg.port,packetID,packetType,dest,sender,vPort,data)
|
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
|
if component.type(rcache[dest][1]) == "modem" then
|
||||||
@ -176,6 +175,7 @@ function start()
|
|||||||
end
|
end
|
||||||
else
|
else
|
||||||
dprint("Not cached", cfg.port,packetID,packetType,dest,sender,vPort,data)
|
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
|
for k,v in pairs(modems) do
|
||||||
if v.type == "modem" then
|
if v.type == "modem" then
|
||||||
v.broadcast(cfg.port,packetID,packetType,dest,sender,vPort,data)
|
v.broadcast(cfg.port,packetID,packetType,dest,sender,vPort,data)
|
||||||
@ -185,6 +185,7 @@ function start()
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
end
|
||||||
|
|
||||||
local function pruneCache()
|
local function pruneCache()
|
||||||
for k,v in pairs(rcache) do
|
for k,v in pairs(rcache) do
|
||||||
@ -231,7 +232,7 @@ function start()
|
|||||||
elseif dest:sub(1,1) == "~" then -- broadcasts start with ~
|
elseif dest:sub(1,1) == "~" then -- broadcasts start with ~
|
||||||
computer.pushSignal("net_broadcast",sender,vPort,data)
|
computer.pushSignal("net_broadcast",sender,vPort,data)
|
||||||
elseif cfg.route then -- repeat packets if route is enabled
|
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
|
end
|
||||||
if not rcache[sender] then -- add the sender to the rcache
|
if not rcache[sender] then -- add the sender to the rcache
|
||||||
dprint("rcache: "..sender..":", localModem,from,computer.uptime())
|
dprint("rcache: "..sender..":", localModem,from,computer.uptime())
|
||||||
|
Loading…
Reference in New Issue
Block a user