Skip to content

Commit

Permalink
use socket.try_open
Browse files Browse the repository at this point in the history
check port bindable or connectable
  • Loading branch information
sniper00 committed Sep 30, 2023
1 parent 2df8da1 commit 4e4a492
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions service/sqldriver.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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 = {}

Expand Down

0 comments on commit 4e4a492

Please sign in to comment.