mirror of
https://github.com/irungentoo/toxcore.git
synced 2024-03-22 13:30:51 +08:00
onion_isconnected fix attempt.
Try to make it more stable.
This commit is contained in:
parent
efea858c91
commit
61dac5c979
|
@ -1419,10 +1419,16 @@ int onion_isconnected(const Onion_Client *onion_c)
|
|||
}
|
||||
}
|
||||
|
||||
unsigned int pnodes = onion_c->path_nodes_index;
|
||||
|
||||
if (pnodes > MAX_ONION_CLIENTS) {
|
||||
pnodes = MAX_ONION_CLIENTS;
|
||||
}
|
||||
|
||||
/* Consider ourselves online if we are announced to half or more nodes
|
||||
we are connected to */
|
||||
if (num && announced) {
|
||||
if ((num / 2) <= announced)
|
||||
if ((num / 2) <= announced && (pnodes / 2) <= num)
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user