mirror of
https://github.com/joyieldInc/predixy.git
synced 2025-12-24 22:46:41 +08:00
fix crash because server without DC, but config defined DC, see #32
This commit is contained in:
parent
28edb79c61
commit
bbbe798629
@ -162,6 +162,9 @@ Server* ServerGroup::getReadServer(Handler* h, DC* localDC) const
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
DC* dc = s->dc();
|
DC* dc = s->dc();
|
||||||
|
if (!dc) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
int dcrp = localDC->getReadPriority(dc);
|
int dcrp = localDC->getReadPriority(dc);
|
||||||
if (dcrp <= 0) {
|
if (dcrp <= 0) {
|
||||||
continue;
|
continue;
|
||||||
@ -221,7 +224,7 @@ Server* ServerGroup::getReadServer(Handler* h, DC* localDC) const
|
|||||||
dc = sdc[0];
|
dc = sdc[0];
|
||||||
found = true;
|
found = true;
|
||||||
}
|
}
|
||||||
if (!found) {//dc maybe nullptr even we found
|
if (!found) {
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
Server* deadServs[Const::MaxServInGroup];
|
Server* deadServs[Const::MaxServInGroup];
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user