From d113b1da1a1994fc99e4a806c7095908a8607966 Mon Sep 17 00:00:00 2001 From: kepler155c Date: Mon, 5 Nov 2018 00:46:07 -0500 Subject: [PATCH] milo wip --- milo/Milo.lua | 1 + milo/MiloRemote.lua | 4 +++- milo/plugins/remote.lua | 9 ++++++--- 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/milo/Milo.lua b/milo/Milo.lua index 722c725..f78c468 100644 --- a/milo/Milo.lua +++ b/milo/Milo.lua @@ -38,6 +38,7 @@ end local config = { monitor = 'type/monitor', + activityMonitor = 'none', remoteDefaults = { }, } Config.load('milo', config) diff --git a/milo/MiloRemote.lua b/milo/MiloRemote.lua index 7c763af..fa16b57 100644 --- a/milo/MiloRemote.lua +++ b/milo/MiloRemote.lua @@ -151,8 +151,10 @@ function page:sendRequest(data) if r and not r.msg then self:setStatus('connected ...') else + msg = r and r.msg or 'Timed out' + socket:close() socket = nil - self:setStatus(r.msg) + break end end end diff --git a/milo/plugins/remote.lua b/milo/plugins/remote.lua index ead9956..e7100dc 100644 --- a/milo/plugins/remote.lua +++ b/milo/plugins/remote.lua @@ -20,7 +20,7 @@ local function getManipulatorForUser(user) end local function client(socket) - _G._debug('connection from ' .. socket.dhost) + _G._debug('REMOTE: connection from ' .. socket.dhost) local user = socket:read(2) if not user then @@ -29,12 +29,15 @@ local function client(socket) local manipulator = getManipulatorForUser(user) if not manipulator then + _debug('REMOTE: Manipulator with introspection module bound with user not found. Closing connection.') socket:write({ msg = 'Manipulator not found' }) + socket:close() return end + _debug('REMOTE: all good') socket:write({ data = 'ok', }) @@ -110,12 +113,12 @@ local function client(socket) end until not socket.connected - _G._debug('disconnected from ' .. socket.dhost) + _G._debug('REMOTE: disconnected from ' .. socket.dhost) end if device.wireless_modem then Event.addRoutine(function() - _G._debug('Milo: listening on port 4242') + _G._debug('REMOTE: listening on port 4242') while true do local socket = Socket.server(4242) Event.addRoutine(function()