mirror of
https://github.com/joyieldInc/predixy.git
synced 2025-12-24 22:46:41 +08:00
support redis4.0 command "cluster nodes" address parse
This commit is contained in:
parent
022a71e4e7
commit
aeedfae544
@ -109,8 +109,18 @@ void ClusterServerPool::handleResponse(Handler* h, ConnectConnection* s, Request
|
|||||||
p.master().data());
|
p.master().data());
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
auto it = mServs.find(p.addr());
|
String addr(p.addr());
|
||||||
|
auto it = mServs.find(addr);
|
||||||
Server* serv = it == mServs.end() ? nullptr : it->second;
|
Server* serv = it == mServs.end() ? nullptr : it->second;
|
||||||
|
if (!serv) {
|
||||||
|
if (strstr(p.flags().data(), "myself")) {
|
||||||
|
serv = s->server();
|
||||||
|
} else if (const char* t = strchr(p.addr().data(), '@')) {
|
||||||
|
addr = String(p.addr().data(), t - p.addr().data());
|
||||||
|
it = mServs.find(addr);
|
||||||
|
serv = it == mServs.end() ? nullptr : it->second;
|
||||||
|
}
|
||||||
|
}
|
||||||
if (!serv) {
|
if (!serv) {
|
||||||
const char* flags = p.flags().data();
|
const char* flags = p.flags().data();
|
||||||
if (p.role() == Server::Unknown ||
|
if (p.role() == Server::Unknown ||
|
||||||
@ -127,7 +137,7 @@ void ClusterServerPool::handleResponse(Handler* h, ConnectConnection* s, Request
|
|||||||
(int)mServPool.size(), p.addr().data());
|
(int)mServPool.size(), p.addr().data());
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
serv = new Server(this, p.addr(), false);
|
serv = new Server(this, addr, false);
|
||||||
serv->setPassword(password());
|
serv->setPassword(password());
|
||||||
mServPool.push_back(serv);
|
mServPool.push_back(serv);
|
||||||
mServs[serv->addr()] = serv;
|
mServs[serv->addr()] = serv;
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user