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

Merge branch 'master' of github.com:ShadowKatStudios/OC-Minitel

This commit is contained in:
Izaya 2018-04-07 00:40:55 +10:00
commit 5a52ca5f8d
2 changed files with 8 additions and 5 deletions

View File

@ -51,6 +51,9 @@
["master/vTunnel/interminitel.lua"] = "/lib", ["master/vTunnel/interminitel.lua"] = "/lib",
["master/vTunnel/vtunnel.lua"] = "/bin", ["master/vTunnel/vtunnel.lua"] = "/bin",
}, },
dependencies = {
["vcomponent"] = ""
},
name = "vTunnel", name = "vTunnel",
description = "Linked card emulator", description = "Linked card emulator",
authors = "Izaya", authors = "Izaya",

View File

@ -87,10 +87,10 @@ spawn(clientLoop)
function pushLoop() function pushLoop()
while true do while true do
for id,msg in pairs(messages) do for id,msg in pairs(messages) do
if msg:len() > 3 then if msg[1]:len() > 3 then
for k,client in pairs(clients) do for k,client in pairs(clients) do
client.conn:send(msg) client.conn:send(msg[1])
reprint("Message #"..tostring(id).." -> Client #"..tostring(k).." - "..msg) reprint("Message #"..tostring(id).." (Client #"..tostring(msg[2]).." -> Client #"..tostring(k).." - "..msg[1])
end end
end end
messages[id] = nil messages[id] = nil
@ -103,10 +103,10 @@ spawn(pushLoop)
function bufferLoop() function bufferLoop()
while true do while true do
for _,client in pairs(clients) do for id,client in pairs(clients) do
if client.buffer:len() > 0 then if client.buffer:len() > 0 then
if imt.decodePacket(client.buffer) then if imt.decodePacket(client.buffer) then
messages[#messages+1] = imt.encodePacket(imt.decodePacket(client.buffer)) messages[#messages+1] = {imt.encodePacket(imt.decodePacket(client.buffer)),id}
client.buffer = imt.getRemainder(client.buffer) or "" client.buffer = imt.getRemainder(client.buffer) or ""
end end
end end