mirror of
https://github.com/ShadowKatStudios/OC-Minitel.git
synced 2024-11-23 10:38:05 +11:00
hopefully this implements linked card routing
This commit is contained in:
parent
62f033cafd
commit
6395a96663
@ -74,6 +74,9 @@ function start()
|
|||||||
v.open(port)
|
v.open(port)
|
||||||
print("Opened port "..port.." on "..v.address)
|
print("Opened port "..port.." on "..v.address)
|
||||||
end
|
end
|
||||||
|
for a,t in component.list("tunnel") do
|
||||||
|
modems[#modems+1] = component.proxy(a)
|
||||||
|
end
|
||||||
|
|
||||||
local function genPacketID()
|
local function genPacketID()
|
||||||
local npID = ""
|
local npID = ""
|
||||||
@ -85,12 +88,18 @@ function start()
|
|||||||
|
|
||||||
local function sendPacket(packetID,packetType,dest,sender,vport,data)
|
local function sendPacket(packetID,packetType,dest,sender,vport,data)
|
||||||
if rcache[dest] then
|
if rcache[dest] then
|
||||||
dprint("Cached", rcache[dest][1],"send",rcache[dest][2],port,packetID,packetType,dest,sender,vport,data)
|
if component.type(rcache[dest][1]) == "modem" then
|
||||||
component.invoke(rcache[dest][1],"send",rcache[dest][2],port,packetID,packetType,dest,sender,vport,data)
|
dprint("Cached", rcache[dest][1],"send",rcache[dest][2],port,packetID,packetType,dest,sender,vport,data)
|
||||||
|
component.invoke(rcache[dest][1],"send",rcache[dest][2],port,packetID,packetType,dest,sender,vport,data)
|
||||||
|
end
|
||||||
else
|
else
|
||||||
dprint("Not cached", port,packetID,packetType,dest,sender,vport,data)
|
dprint("Not cached", port,packetID,packetType,dest,sender,vport,data)
|
||||||
for k,v in pairs(modems) do
|
for k,v in pairs(modems) do
|
||||||
v.broadcast(port,packetID,packetType,dest,sender,vport,data)
|
if v.type == "modem" then
|
||||||
|
v.broadcast(port,packetID,packetType,dest,sender,vport,data)
|
||||||
|
elseif v.type == "tunnel" then
|
||||||
|
v.send(packetID,packetType,dest,sender,vport,data)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@ -122,7 +131,7 @@ function start()
|
|||||||
|
|
||||||
local function processPacket(_,localModem,from,pport,_,packetID,packetType,dest,sender,vport,data)
|
local function processPacket(_,localModem,from,pport,_,packetID,packetType,dest,sender,vport,data)
|
||||||
pruneCache()
|
pruneCache()
|
||||||
if pport == port then
|
if pport == port or pport == 0 then -- for linked cards
|
||||||
dprint(port,vport,packetType,dest)
|
dprint(port,vport,packetType,dest)
|
||||||
if checkPCache(packetID) then return end
|
if checkPCache(packetID) then return end
|
||||||
if dest == hostname then
|
if dest == hostname then
|
||||||
|
Loading…
Reference in New Issue
Block a user