mirror of
https://github.com/cloudwu/skynet.git
synced 2026-07-25 04:33:05 +00:00
add socketchannel:changhost
This commit is contained in:
@@ -84,6 +84,7 @@ local function mongo_auth(mongoc)
|
|||||||
end
|
end
|
||||||
return function()
|
return function()
|
||||||
assert(mongoc:auth(user, pass))
|
assert(mongoc:auth(user, pass))
|
||||||
|
-- todo : If mongoc want to connect to replica set, runCommand ismater here, and call mongoc.__sock:changehost
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -175,11 +175,11 @@ local function connect_once(self)
|
|||||||
end
|
end
|
||||||
|
|
||||||
self.__authcoroutine = false
|
self.__authcoroutine = false
|
||||||
return true
|
return self.__sock ~= nil
|
||||||
end
|
end
|
||||||
|
|
||||||
local function try_connect(self , once)
|
local function try_connect(self , once)
|
||||||
local t = 100
|
local t = 0
|
||||||
while not self.__closed do
|
while not self.__closed do
|
||||||
if connect_once(self) then
|
if connect_once(self) then
|
||||||
if not once then
|
if not once then
|
||||||
@@ -292,6 +292,16 @@ function channel:close()
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function channel:changehost(host, port)
|
||||||
|
self.__host = host
|
||||||
|
if port then
|
||||||
|
self.__port = port
|
||||||
|
end
|
||||||
|
if not self.__closed then
|
||||||
|
close_channel_socket(self)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
channel_meta.__gc = channel.close
|
channel_meta.__gc = channel.close
|
||||||
|
|
||||||
local function wrapper_socket_function(f)
|
local function wrapper_socket_function(f)
|
||||||
|
|||||||
Reference in New Issue
Block a user