1
0
mirror of https://github.com/ShadowKatStudios/OC-Minitel.git synced 2024-11-23 02:28:05 +11:00

hopefully fixed routing in microtel-3, and made it smaller while I was at it

This commit is contained in:
Izaya 2018-03-30 22:22:57 +11:00
parent 0c49e2c283
commit 206e038d8d
2 changed files with 10 additions and 5 deletions

View File

@ -17,17 +17,21 @@ local function genPacketID()
return packetID
end
local function sendPacket(packetID,packetType,to,vport,data)
packetCache[packetID] = computer.uptime()
local function rawSendPacket(packetID,packetType,to,from,vport,data)
if routeCache[to] then
modems[routeCache[to][1]].send(routeCache[to][2],net.port,packetID,packetType,to,net.hostname,vport,data)
modems[routeCache[to][1]].send(routeCache[to][2],net.port,packetID,packetType,to,from,vport,data)
else
for k,v in pairs(modems) do
v.broadcast(net.port,packetID,packetType,to,net.hostname,vport,data)
v.broadcast(net.port,packetID,packetType,to,from,vport,data)
end
end
end
local function sendPacket(packetID,packetType,to,vport,data)
packetCache[packetID] = computer.uptime()
rawSendPacket(packetID,packetType,to,net.hostname,vport,data)
end
function net.send(to,vport,data,packetType,packetID)
packetType,packetID = packetType or 1, packetID or genPacketID()
packetQueue[packetID] = {packetType,to,vport,data,0}
@ -71,7 +75,7 @@ function computer.pullSignal(t)
packetQueue[eventTab[11]] = nil
end
elseif net.route and checkCache(eventTab[6]) then
sendPacket(eventTab[6],eventTab[7],eventTab[8],eventTab[9],eventTab[10],eventTab[11])
rawSendPacket(eventTab[6],eventTab[7],eventTab[8],eventTab[9],eventTab[10],eventTab[11])
end
packetCache[eventTab[6]] = computer.uptime()
end

View File

@ -9,6 +9,7 @@ sed -i -e 's/packetType/pT/g' microtel-3-mini.lua
sed -i -e 's/to/T/g' microtel-3-mini.lua
sed -i -e 's/vport/vP/g' microtel-3-mini.lua
sed -i -e 's/data/D/g' microtel-3-mini.lua
sed -i -e 's/rawSendPacket/rS/g' microtel-3-mini.lua
sed -i -e 's/sendPacket/sP/g' microtel-3-mini.lua
sed -i -e 's/genPacketID/gP/g' microtel-3-mini.lua
sed -i -e 's/packetCache/pC/g' microtel-3-mini.lua