diff options
author | iphydf <iphydf@users.noreply.github.com> | 2018-08-27 12:52:34 +0000 |
---|---|---|
committer | iphydf <iphydf@users.noreply.github.com> | 2018-08-27 12:54:46 +0000 |
commit | 0075374f2bb3bb72ef1112471f1aacf12b6b6658 (patch) | |
tree | add97dd9763a59685c3c36003c5962905cf6d751 /toxcore/onion_client.c | |
parent | 25a477a7e429f108cb690d0c24701272ec30195f (diff) |
Make `ip_is_lan` return bool instead of 0/-1.
This inverts the truthiness of the return value. Previously, 0 meant
`true` and -1 meant `false`. Now, `true` (1) means `true` and `false` (0)
means `false`.
Diffstat (limited to 'toxcore/onion_client.c')
-rw-r--r-- | toxcore/onion_client.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/toxcore/onion_client.c b/toxcore/onion_client.c index ae12f908..87b0c79c 100644 --- a/toxcore/onion_client.c +++ b/toxcore/onion_client.c | |||
@@ -806,13 +806,11 @@ static int client_ping_nodes(Onion_Client *onion_c, uint32_t num, const Node_for | |||
806 | last_pinged_index = &onion_c->friends_list[num - 1].last_pinged_index; | 806 | last_pinged_index = &onion_c->friends_list[num - 1].last_pinged_index; |
807 | } | 807 | } |
808 | 808 | ||
809 | unsigned int i, j; | 809 | const bool lan_ips_accepted = ip_is_lan(source.ip); |
810 | int lan_ips_accepted = (ip_is_lan(source.ip) == 0); | ||
811 | |||
812 | for (i = 0; i < num_nodes; ++i) { | ||
813 | 810 | ||
811 | for (uint32_t i = 0; i < num_nodes; ++i) { | ||
814 | if (!lan_ips_accepted) { | 812 | if (!lan_ips_accepted) { |
815 | if (ip_is_lan(nodes[i].ip_port.ip) == 0) { | 813 | if (ip_is_lan(nodes[i].ip_port.ip)) { |
816 | continue; | 814 | continue; |
817 | } | 815 | } |
818 | } | 816 | } |
@@ -821,6 +819,8 @@ static int client_ping_nodes(Onion_Client *onion_c, uint32_t num, const Node_for | |||
821 | || id_closest(reference_id, list_nodes[0].public_key, nodes[i].public_key) == 2 | 819 | || id_closest(reference_id, list_nodes[0].public_key, nodes[i].public_key) == 2 |
822 | || onion_node_timed_out(&list_nodes[1], onion_c->mono_time) | 820 | || onion_node_timed_out(&list_nodes[1], onion_c->mono_time) |
823 | || id_closest(reference_id, list_nodes[1].public_key, nodes[i].public_key) == 2) { | 821 | || id_closest(reference_id, list_nodes[1].public_key, nodes[i].public_key) == 2) { |
822 | uint32_t j; | ||
823 | |||
824 | /* check if node is already in list. */ | 824 | /* check if node is already in list. */ |
825 | for (j = 0; j < list_length; ++j) { | 825 | for (j = 0; j < list_length; ++j) { |
826 | if (public_key_cmp(list_nodes[j].public_key, nodes[i].public_key) == 0) { | 826 | if (public_key_cmp(list_nodes[j].public_key, nodes[i].public_key) == 0) { |