mirror of
https://github.com/cloudwu/skynet.git
synced 2026-07-25 12:43:09 +00:00
socketchannel backup support host/port
This commit is contained in:
@@ -155,11 +155,18 @@ end
|
|||||||
|
|
||||||
local function connect_backup(self)
|
local function connect_backup(self)
|
||||||
if self.__backup then
|
if self.__backup then
|
||||||
for _, host in ipairs(self.__backup) do
|
for _, addr in ipairs(self.__backup) do
|
||||||
skynet.error("socket: connect to backup host", host, self.__port)
|
local host, port
|
||||||
local fd = socket.open(host, self.__port)
|
if type(host) == "table" then
|
||||||
|
host, port = addr.host, addr.port
|
||||||
|
else
|
||||||
|
host = addr
|
||||||
|
end
|
||||||
|
skynet.error("socket: connect to backup host", host, port)
|
||||||
|
local fd = socket.open(host, port)
|
||||||
if fd then
|
if fd then
|
||||||
self.__host = host
|
self.__host = host
|
||||||
|
self.__port = port
|
||||||
return fd
|
return fd
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user