mirror of
https://github.com/irungentoo/toxcore.git
synced 2024-03-22 13:30:51 +08:00
Merge branch 'lehi-dev' of https://github.com/lehitoskin/ProjectTox-Core into lehitoskin-lehi-dev
This commit is contained in:
commit
f152d4c94d
|
@ -425,22 +425,23 @@ static uint8_t candidates_create_internal(Assoc *assoc, hash_t hash, uint8_t *id
|
|||
* 1. seen bad, heard good
|
||||
* 2. seen good
|
||||
* 3. used */
|
||||
// enumerated lists are superior to magic numbers
|
||||
if (!is_timeout(entry->used_at, BAD_NODE_TIMEOUT))
|
||||
check = 3;
|
||||
check = USED;
|
||||
|
||||
if (!is_timeout(entry->seen_at, CANDIDATES_SEEN_TIMEOUT))
|
||||
check = 2;
|
||||
check = SEENG;
|
||||
else if (!is_timeout(entry->heard_at, CANDIDATES_HEARD_TIMEOUT))
|
||||
check = 1;
|
||||
check = SEENB_HEARDG;
|
||||
else
|
||||
check = 0;
|
||||
check = BAD;
|
||||
|
||||
if (!pos_check[check])
|
||||
pos_check[check] = pos + 1;
|
||||
}
|
||||
|
||||
/* used > seen > heard > bad */
|
||||
size_t i, pos_max = used ? 3 : (seen ? 2 : 1);
|
||||
size_t i, pos_max = used ? USED : (seen ? SEENG : SEENB_HEARDG);
|
||||
|
||||
for (i = 0; i < pos_max; i++)
|
||||
if (pos_check[i]) {
|
||||
|
|
|
@ -7,6 +7,9 @@
|
|||
|
||||
/* For the legalese parts, see tox.h. */
|
||||
|
||||
/* enumerated lists are superior to magic numbers */
|
||||
enum NODE_STATUS { BAD, SEENB_HEARDG, SEENG, USED };
|
||||
|
||||
/*
|
||||
* Module to store currently unused ID <=> IP associations
|
||||
* for a potential future use
|
||||
|
|
Loading…
Reference in New Issue
Block a user