Catch luampd socket error and reconnect

This commit is contained in:
crater2150 2012-03-26 16:30:53 +02:00
parent c56bbec1db
commit e37b2d3403
2 changed files with 3 additions and 4 deletions

View file

@ -36,7 +36,8 @@ M.disconnect = function()
end
M.ensure_connection = function()
if conn == nil then M.connect() end
-- luampd throws SOCKET_ERRORs all the time. catch them and reconnect
if conn == nil or not pcall(conn:status()) then M.connect() end
end
-- }}}