Skip to content
Snippets Groups Projects
Commit e95d3a0e authored by Roman Tsisyk's avatar Roman Tsisyk
Browse files

Fix #929: disconnect trigger is not invoked by console.connect()

Explicitly close net.box connection on error.
parent 0e36259a
No related branches found
No related tags found
No related merge requests found
......@@ -291,11 +291,17 @@ local function connect(uri)
end
-- check connection && permissions
local status, reason
if remote.console then
remote:console('return true')
status, reason = pcall(remote.console, remote, 'return true')
else
remote:eval('return true')
status, reason = pcall(remote.eval, remote, 'return true')
end
if not status then
remote:close() -- don't leak net.box connection
error(reason) -- re-throw original error (there is no better way)
end
-- override methods
self.remote = remote
self.eval = remote_eval
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment