milo wip
This commit is contained in:
@@ -38,6 +38,7 @@ end
|
|||||||
|
|
||||||
local config = {
|
local config = {
|
||||||
monitor = 'type/monitor',
|
monitor = 'type/monitor',
|
||||||
|
activityMonitor = 'none',
|
||||||
remoteDefaults = { },
|
remoteDefaults = { },
|
||||||
}
|
}
|
||||||
Config.load('milo', config)
|
Config.load('milo', config)
|
||||||
|
|||||||
@@ -151,8 +151,10 @@ function page:sendRequest(data)
|
|||||||
if r and not r.msg then
|
if r and not r.msg then
|
||||||
self:setStatus('connected ...')
|
self:setStatus('connected ...')
|
||||||
else
|
else
|
||||||
|
msg = r and r.msg or 'Timed out'
|
||||||
|
socket:close()
|
||||||
socket = nil
|
socket = nil
|
||||||
self:setStatus(r.msg)
|
break
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ local function getManipulatorForUser(user)
|
|||||||
end
|
end
|
||||||
|
|
||||||
local function client(socket)
|
local function client(socket)
|
||||||
_G._debug('connection from ' .. socket.dhost)
|
_G._debug('REMOTE: connection from ' .. socket.dhost)
|
||||||
|
|
||||||
local user = socket:read(2)
|
local user = socket:read(2)
|
||||||
if not user then
|
if not user then
|
||||||
@@ -29,12 +29,15 @@ local function client(socket)
|
|||||||
|
|
||||||
local manipulator = getManipulatorForUser(user)
|
local manipulator = getManipulatorForUser(user)
|
||||||
if not manipulator then
|
if not manipulator then
|
||||||
|
_debug('REMOTE: Manipulator with introspection module bound with user not found. Closing connection.')
|
||||||
socket:write({
|
socket:write({
|
||||||
msg = 'Manipulator not found'
|
msg = 'Manipulator not found'
|
||||||
})
|
})
|
||||||
|
socket:close()
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
|
_debug('REMOTE: all good')
|
||||||
socket:write({
|
socket:write({
|
||||||
data = 'ok',
|
data = 'ok',
|
||||||
})
|
})
|
||||||
@@ -110,12 +113,12 @@ local function client(socket)
|
|||||||
end
|
end
|
||||||
until not socket.connected
|
until not socket.connected
|
||||||
|
|
||||||
_G._debug('disconnected from ' .. socket.dhost)
|
_G._debug('REMOTE: disconnected from ' .. socket.dhost)
|
||||||
end
|
end
|
||||||
|
|
||||||
if device.wireless_modem then
|
if device.wireless_modem then
|
||||||
Event.addRoutine(function()
|
Event.addRoutine(function()
|
||||||
_G._debug('Milo: listening on port 4242')
|
_G._debug('REMOTE: listening on port 4242')
|
||||||
while true do
|
while true do
|
||||||
local socket = Socket.server(4242)
|
local socket = Socket.server(4242)
|
||||||
Event.addRoutine(function()
|
Event.addRoutine(function()
|
||||||
|
|||||||
Reference in New Issue
Block a user