Automated negotiation of nsh sessions. Fancy stuff.
This commit is contained in:
parent
4552888f8b
commit
295314cc4e
@ -1,4 +1,4 @@
|
||||
function nshc(evPP,nid)
|
||||
function nshc_w(evPP,nid)
|
||||
write("\f")
|
||||
while true do
|
||||
if ev[1] == "net_msg" then
|
||||
@ -14,3 +14,16 @@ function nshc(evPP,nid)
|
||||
C.yield()
|
||||
end
|
||||
end
|
||||
|
||||
function nshc(P,nid)
|
||||
ns(nid,P,"initnsh")
|
||||
while true do
|
||||
if ev[1] == "net_msg" then
|
||||
print(T.unpack(ev))
|
||||
end
|
||||
if ev[1] == "net_msg" and ev[2] == nid and ev[3] == P then
|
||||
nshc_w(ev[4],nid)
|
||||
end
|
||||
C.yield()
|
||||
end
|
||||
end
|
||||
|
@ -1,21 +1,36 @@
|
||||
function nshd(evPP,tEPs,sI)
|
||||
s("netsh daemon",function() print(pcall(function()
|
||||
function nshd_w(evPP,cA,sI)
|
||||
s("netsh daemon - "..tostring(sI),function() print(pcall(function()
|
||||
while true do
|
||||
if ev[1] == "net_msg" then
|
||||
local V,msg=false,tostring(ev[4])
|
||||
for k,v in ipairs(tEPs) do if ev[2] == v then V=true end end
|
||||
if ev[3] == evPP and V then
|
||||
local msg=tostring(ev[4])
|
||||
if ev[3] == evPP and ev[2] == cA then
|
||||
if msg:sub(1,3) == "key" then
|
||||
h("key",tT[cT][3].sI,tonumber(msg:sub(4)),0)
|
||||
end
|
||||
end
|
||||
elseif ev[1] == "display" and ev[3] == tT[cT][3].sI then
|
||||
for k,v in ipairs(tEPs) do
|
||||
ns(v,evPP,"dis"..tostring(ev[2]))
|
||||
end
|
||||
ns(cA,evPP,"dis"..tostring(ev[2]))
|
||||
end
|
||||
C.yield()
|
||||
end
|
||||
end)) end,{["sI"]=sI})
|
||||
luash({["sI"]=sI})
|
||||
end
|
||||
|
||||
function nshd(P)
|
||||
s("nshd",function() print(pcall(function()
|
||||
local Cc=1
|
||||
while true do
|
||||
if ev[1] == "net_msg" and ev[3] == P then
|
||||
if ev[4] == "initnsh" then
|
||||
nnID="nsh-"..tostring(Cc)
|
||||
Cc=Cc+1
|
||||
ns(ev[2],P,nnID)
|
||||
nshd_w(nnID,ev[2],nnID)
|
||||
luash({["sI"]=nnID})
|
||||
print("[nshd]Spawned "..nnID.." for "..tostring(ev[2]))
|
||||
end
|
||||
end
|
||||
C.yield()
|
||||
end end))
|
||||
end,{["sI"]="log"})
|
||||
end
|
||||
|
Loading…
Reference in New Issue
Block a user