mirror of
https://github.com/cloudwu/skynet.git
synced 2026-07-24 12:20:41 +00:00
修复redis auth操作没有进行compose_message的bug,该bug导致skynet连接twemproxy时,auth失败
This commit is contained in:
@@ -63,6 +63,7 @@ redcmd[42] = function(fd, data) -- '*'
|
|||||||
end
|
end
|
||||||
|
|
||||||
-------------------
|
-------------------
|
||||||
|
local compose_message
|
||||||
|
|
||||||
local function redis_login(auth, db)
|
local function redis_login(auth, db)
|
||||||
if auth == nil and db == nil then
|
if auth == nil and db == nil then
|
||||||
@@ -70,10 +71,10 @@ local function redis_login(auth, db)
|
|||||||
end
|
end
|
||||||
return function(so)
|
return function(so)
|
||||||
if auth then
|
if auth then
|
||||||
so:request("AUTH "..auth.."\r\n", read_response)
|
so:request(compose_message("AUTH", auth), read_response)
|
||||||
end
|
end
|
||||||
if db then
|
if db then
|
||||||
so:request("SELECT "..db.."\r\n", read_response)
|
so:request(compose_message("SELECT", db), read_response)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -122,7 +123,7 @@ local count_cache = make_cache(function(t,k)
|
|||||||
return s
|
return s
|
||||||
end)
|
end)
|
||||||
|
|
||||||
local function compose_message(cmd, msg)
|
function compose_message(cmd, msg)
|
||||||
local t = type(msg)
|
local t = type(msg)
|
||||||
local lines = {}
|
local lines = {}
|
||||||
|
|
||||||
@@ -233,7 +234,7 @@ local watchmeta = {
|
|||||||
local function watch_login(obj, auth)
|
local function watch_login(obj, auth)
|
||||||
return function(so)
|
return function(so)
|
||||||
if auth then
|
if auth then
|
||||||
so:request("AUTH "..auth.."\r\n", read_response)
|
so:request(compose_message("AUTH", auth), read_response)
|
||||||
end
|
end
|
||||||
for k in pairs(obj.__psubscribe) do
|
for k in pairs(obj.__psubscribe) do
|
||||||
so:request(compose_message ("PSUBSCRIBE", k))
|
so:request(compose_message ("PSUBSCRIBE", k))
|
||||||
|
|||||||
Reference in New Issue
Block a user