1
0
mirror of https://github.com/kepler155c/opus synced 2025-11-21 17:44:54 +00:00

build using command computer

This commit is contained in:
kepler155c@gmail.com
2017-08-09 10:19:00 -04:00
parent c21afd2875
commit 97f3392fbd
11 changed files with 211 additions and 124 deletions

View File

@@ -5,27 +5,29 @@ local netfs = { }
local function remoteCommand(node, msg)
if not node.socket then
node.socket = Socket.connect(node.id, 139)
end
for i = 1, 2 do
if not node.socket then
node.socket = Socket.connect(node.id, 139)
end
if not node.socket then
error('netfs: Unable to establish connection to ' .. node.id)
fs.unmount(node.mountPoint)
return
end
if not node.socket then
error('netfs: Unable to establish connection to ' .. node.id)
fs.unmount(node.mountPoint)
return
end
local ret
synchronized(node.socket, function()
node.socket:write(msg)
ret = node.socket:read(2)
end)
local ret
synchronized(node.socket, function()
node.socket:write(msg)
ret = node.socket:read(1)
end)
if ret then
return ret.response
if ret then
return ret.response
end
node.socket:close()
node.socket = nil
end
node.socket:close()
node.socket = nil
error('netfs: Connection failed', 2)
end