diff --git a/lib/tarantool_server.py b/lib/tarantool_server.py index 4b62a37c..c33fb332 100644 --- a/lib/tarantool_server.py +++ b/lib/tarantool_server.py @@ -1315,11 +1315,20 @@ def get_iproto_port(self): end end end - if #res ~= 1 then + local l_sockets = {{}} + local con_timeout = 0.1 + for i, s in ipairs(res) do + con = socket.tcp_connect(s.host, s.port, con_timeout) + if con then + con:close() + table.insert(l_sockets, s) + end + end + if #l_sockets ~= 1 then error(("Zero or more than one listening TCP sockets: %s") - :format(#res)) + :format(#l_sockets)) end - return {{host = res[1].host, port = res[1].port}} + return {{host = l_sockets[1].host, port = l_sockets[1].port}} end """.format(localhost=self.localhost) res = yaml.safe_load(self.admin(script, silent=True))[0]