diff --git a/testing/nTox.c b/testing/nTox.c index 53cbbb5d..edda43b1 100644 --- a/testing/nTox.c +++ b/testing/nTox.c @@ -1255,9 +1255,9 @@ int main(int argc, char *argv[]) new_lines(idstring); strcpy(input_line, ""); - uint16_t port = htons(atoi(argv[argvoffset + 2])); + uint16_t port = atoi(argv[argvoffset + 2]); unsigned char *binary_string = hex_string_to_bin(argv[argvoffset + 3]); - int res = tox_bootstrap_from_address(m, argv[argvoffset + 1], ipv6enabled, port, binary_string); + int res = tox_bootstrap_from_address(m, argv[argvoffset + 1], port, binary_string); if (!res) { printf("Failed to convert \"%s\" into an IP address. Exiting...\n", argv[argvoffset + 1]); @@ -1290,7 +1290,7 @@ int main(int argc, char *argv[]) if (timestamp0 + 10 < timestamp1) { timestamp0 = timestamp1; - tox_bootstrap_from_address(m, argv[argvoffset + 1], ipv6enabled, port, binary_string); + tox_bootstrap_from_address(m, argv[argvoffset + 1], port, binary_string); } } } diff --git a/testing/tox_sync.c b/testing/tox_sync.c index 206e613f..8b64b6ca 100644 --- a/testing/tox_sync.c +++ b/testing/tox_sync.c @@ -220,9 +220,9 @@ int main(int argc, char *argv[]) tox_callback_file_send_request(tox, file_request_accept, NULL); tox_callback_connection_status(tox, print_online, NULL); - uint16_t port = htons(atoi(argv[argvoffset + 2])); + uint16_t port = atoi(argv[argvoffset + 2]); unsigned char *binary_string = hex_string_to_bin(argv[argvoffset + 3]); - int res = tox_bootstrap_from_address(tox, argv[argvoffset + 1], ipv6enabled, port, binary_string); + int res = tox_bootstrap_from_address(tox, argv[argvoffset + 1], port, binary_string); free(binary_string); if (!res) { diff --git a/toxcore/tox.c b/toxcore/tox.c index 4b9cff8e..a43a9554 100644 --- a/toxcore/tox.c +++ b/toxcore/tox.c @@ -782,12 +782,11 @@ static int tox_add_tcp_relay(Tox *tox, const char *address, uint8_t ipv6enabled, } } -int tox_bootstrap_from_address(Tox *tox, const char *address, - uint8_t ipv6enabled, uint16_t port, const uint8_t *public_key) +int tox_bootstrap_from_address(Tox *tox, const char *address, uint16_t port, const uint8_t *public_key) { Messenger *m = tox; - tox_add_tcp_relay(tox, address, ipv6enabled, port, public_key); - return DHT_bootstrap_from_address(m->dht, address, ipv6enabled, port, public_key); + tox_add_tcp_relay(tox, address, m->options.ipv6enabled, htons(port), public_key); + return DHT_bootstrap_from_address(m->dht, address, m->options.ipv6enabled, htons(port), public_key); } /* return 0 if we are not connected to the DHT. diff --git a/toxcore/tox.h b/toxcore/tox.h index 6cad6b10..c9a6bc70 100644 --- a/toxcore/tox.h +++ b/toxcore/tox.h @@ -603,19 +603,15 @@ uint64_t tox_file_data_remaining(const Tox *tox, int32_t friendnumber, uint8_t f */ /* Resolves address into an IP address. If successful, sends a "get nodes" - * request to the given node with ip, port (in network byte order, HINT: use htons()) + * request to the given node with ip, port (in host byte order). * and public_key to setup connections * * address can be a hostname or an IP address (IPv4 or IPv6). - * if ipv6enabled is 0 (zero), the resolving sticks STRICTLY to IPv4 addresses - * if ipv6enabled is not 0 (zero), the resolving looks for IPv6 addresses first, - * then IPv4 addresses. * * returns 1 if the address could be converted into an IP address * returns 0 otherwise */ -int tox_bootstrap_from_address(Tox *tox, const char *address, uint8_t ipv6enabled, - uint16_t port, const uint8_t *public_key); +int tox_bootstrap_from_address(Tox *tox, const char *address, uint16_t port, const uint8_t *public_key); /* return 0 if we are not connected to the DHT. * return 1 if we are.