diff options
Diffstat (limited to 'toxcore/DHT.c')
-rw-r--r-- | toxcore/DHT.c | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/toxcore/DHT.c b/toxcore/DHT.c index 31512a39..b680b12a 100644 --- a/toxcore/DHT.c +++ b/toxcore/DHT.c | |||
@@ -814,8 +814,10 @@ static int cmp_dht_entry(const void *a, const void *b) | |||
814 | Client_data entry2 = cmp2.entry; | 814 | Client_data entry2 = cmp2.entry; |
815 | const uint8_t *cmp_public_key = cmp1.base_public_key; | 815 | const uint8_t *cmp_public_key = cmp1.base_public_key; |
816 | 816 | ||
817 | int t1 = is_timeout(entry1.assoc4.timestamp, BAD_NODE_TIMEOUT) && is_timeout(entry1.assoc6.timestamp, BAD_NODE_TIMEOUT); | 817 | #define ASSOC_TIMEOUT(assoc) is_timeout((assoc).timestamp, BAD_NODE_TIMEOUT) |
818 | int t2 = is_timeout(entry2.assoc4.timestamp, BAD_NODE_TIMEOUT) && is_timeout(entry2.assoc6.timestamp, BAD_NODE_TIMEOUT); | 818 | |
819 | bool t1 = ASSOC_TIMEOUT(entry1.assoc4) && ASSOC_TIMEOUT(entry1.assoc6); | ||
820 | bool t2 = ASSOC_TIMEOUT(entry2.assoc4) && ASSOC_TIMEOUT(entry2.assoc6); | ||
819 | 821 | ||
820 | if (t1 && t2) { | 822 | if (t1 && t2) { |
821 | return 0; | 823 | return 0; |
@@ -829,10 +831,10 @@ static int cmp_dht_entry(const void *a, const void *b) | |||
829 | return 1; | 831 | return 1; |
830 | } | 832 | } |
831 | 833 | ||
832 | t1 = hardening_correct(&entry1.assoc4.hardening) != HARDENING_ALL_OK | 834 | #define INCORRECT_HARDENING(assoc) hardening_correct(&(assoc).hardening) != HARDENING_ALL_OK |
833 | && hardening_correct(&entry1.assoc6.hardening) != HARDENING_ALL_OK; | 835 | |
834 | t2 = hardening_correct(&entry2.assoc4.hardening) != HARDENING_ALL_OK | 836 | t1 = INCORRECT_HARDENING(entry1.assoc4) && INCORRECT_HARDENING(entry1.assoc6); |
835 | && hardening_correct(&entry2.assoc6.hardening) != HARDENING_ALL_OK; | 837 | t2 = INCORRECT_HARDENING(entry2.assoc4) && INCORRECT_HARDENING(entry2.assoc6); |
836 | 838 | ||
837 | if (t1 != t2) { | 839 | if (t1 != t2) { |
838 | if (t1) { | 840 | if (t1) { |