Basically just test if we are connected every second and reconnect if we
are not.
_try_reconnect = false,
_idle_subsystems = { ... }
}, { __index = mpc })
_try_reconnect = false,
_idle_subsystems = { ... }
}, { __index = mpc })
if self._connected then return end
-- Reset all of our state
self._reply_handlers = {}
if self._connected then return end
-- Reset all of our state
self._reply_handlers = {}
end
function mpc:send(...)
end
function mpc:send(...)
if not self._connected then
return
end
if not self._connected then
return
end
function widget:error_handler(err)
self._textbox:set_text("Error: " .. tostring(err))
function widget:error_handler(err)
self._textbox:set_text("Error: " .. tostring(err))
- timer.start_new(10, function()
- self._connection:send("ping")
- end)
end
function widget:run()
end
function widget:run()
+ self._keep_alive_timer = timer {
+ timeout = 1
+ , autostart = true
+ , callback = function() self._connection:connect() end
+ , call_now = true
+ }
+
self._timer = timer({ timeout = 1 })
self._timer:connect_signal("timeout", function() self:popup_update() end)
self._timer = timer({ timeout = 1 })
self._timer:connect_signal("timeout", function() self:popup_update() end)