1
This commit is contained in:
parent
12fe9247a2
commit
c388dbf87e
@ -198,6 +198,17 @@ GSNode* GSMgr::AllocNode(int channel)
|
|||||||
std::vector<GSNode*>* sorted_nodes = GetSortedNodesByChannel(channel);
|
std::vector<GSNode*>* sorted_nodes = GetSortedNodesByChannel(channel);
|
||||||
if (sorted_nodes && !sorted_nodes->empty()) {
|
if (sorted_nodes && !sorted_nodes->empty()) {
|
||||||
size_t rnd = std::min((size_t)2, sorted_nodes->size());
|
size_t rnd = std::min((size_t)2, sorted_nodes->size());
|
||||||
|
if (rnd >= 2) {
|
||||||
|
GSNode* n1 = sorted_nodes->at(sorted_nodes->size() - 1);
|
||||||
|
GSNode* n2 = sorted_nodes->at(sorted_nodes->size() - 2);
|
||||||
|
if (n1->online_num < 100 && n2->online_num < 100) {
|
||||||
|
if (n1->instance_id < n2->instance_id) {
|
||||||
|
return n1;
|
||||||
|
} else {
|
||||||
|
return n2;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
int idx = rand() % rnd;
|
int idx = rand() % rnd;
|
||||||
while (idx >= 0) {
|
while (idx >= 0) {
|
||||||
if (sorted_nodes->at(idx)->servicing) {
|
if (sorted_nodes->at(idx)->servicing) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user