@@ -39,11 +39,9 @@ local function open_channel(t, key)
3939 end
4040 local succ , err , c
4141 if address then
42- local host , port = string.match (address , " (.+):([^:]+)$" )
43- host = host :match (" ^%[(.-)%]$" ) or host
4442 c = node_sender [key ]
4543 if c == nil then
46- c = skynet .newservice (" clustersender" , key , nodename , host , port )
44+ c = skynet .newservice (" clustersender" , key , nodename , address )
4745 if node_sender [key ] then
4846 -- double check
4947 skynet .kill (c )
@@ -53,14 +51,14 @@ local function open_channel(t, key)
5351 end
5452 end
5553
56- succ = pcall (skynet .call , c , " lua" , " changenode" , host , port )
54+ succ = pcall (skynet .call , c , " lua" , " changenode" , address )
5755
5856 if succ then
5957 t [key ] = c
6058 ct .channel = c
6159 node_sender_closed [key ] = nil
6260 else
63- err = string.format (" changenode [%s] (%s:%s) failed" , key , host , port )
61+ err = string.format (" changenode [%s] (%s:%s) failed" , key , address )
6462 end
6563 elseif address == false then
6664 c = node_sender [key ]
@@ -147,11 +145,7 @@ function command.listen(source, addr, port, maxclient)
147145 local gate = skynet .newservice (" gate" )
148146 if port == nil then
149147 local address = assert (node_address [addr ], addr .. " is down" )
150- addr , port = string.match (address , " (.+):([^:]+)$" )
151- addr = addr :match (" ^%[(.-)%]$" ) or addr
152- port = tonumber (port )
153- assert (port ~= 0 )
154- skynet .call (gate , " lua" , " open" , { address = addr , port = port , maxclient = maxclient })
148+ skynet .call (gate , " lua" , " open" , { address = address , port = port , maxclient = maxclient })
155149 skynet .ret (skynet .pack (addr , port ))
156150 else
157151 local realaddr , realport = skynet .call (gate , " lua" , " open" , { address = addr , port = port , maxclient = maxclient })
0 commit comments