From 4e4a492e78bd5302d856c305a350fc41e407f267 Mon Sep 17 00:00:00 2001 From: bruce Date: Sat, 30 Sep 2023 16:44:07 +0800 Subject: [PATCH] use socket.try_open check port bindable or connectable --- service/sqldriver.lua | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/service/sqldriver.lua b/service/sqldriver.lua index 4bf440fab..213551b5b 100644 --- a/service/sqldriver.lua +++ b/service/sqldriver.lua @@ -107,9 +107,9 @@ if conf.name then end) end - local fd = socket.sync_connect(conf.opts.host, conf.opts.port, moon.PTYPE_SOCKET_TCP) - assert(fd, string.format("connect failed provider: %s host: %s port: %s", conf.provider, conf.opts.host, conf.opts.port)) - socket.close(fd) + assert(socket.try_open(conf.opts.host, conf.opts.port, true), + string.format("connect failed provider: %s host: %s port: %s", conf.provider, conf.opts.host, conf.opts.port)) + local command = {}