summaryrefslogtreecommitdiff
path: root/protocols
diff options
context:
space:
mode:
authorKirill Volinsky <mataes2007@gmail.com>2015-02-18 20:31:14 +0000
committerKirill Volinsky <mataes2007@gmail.com>2015-02-18 20:31:14 +0000
commita434de21b52ff537346f279bb358a486759b6f25 (patch)
treeafa0c83f0f27f22202261d003ab7d0a517b4c34e /protocols
parent4e8f0184433089b71b04d491bc12ab612dd5cadc (diff)
Tox: fixed bootstrappig of IPv6 nodes
git-svn-id: http://svn.miranda-ng.org/main/trunk@12187 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'protocols')
-rw-r--r--protocols/Tox/src/tox_network.cpp23
1 files changed, 14 insertions, 9 deletions
diff --git a/protocols/Tox/src/tox_network.cpp b/protocols/Tox/src/tox_network.cpp
index 86afc17607..2db215a01d 100644
--- a/protocols/Tox/src/tox_network.cpp
+++ b/protocols/Tox/src/tox_network.cpp
@@ -9,34 +9,39 @@ void CToxProto::BootstrapNodes()
{
debugLogA("CToxProto::BootstrapDht: bootstraping DHT");
- bool isIPv4 = getBool("DisableIPv6", 0);
+ bool isIPv4Only = getBool("DisableIPv6", 0);
int nodeCount = db_get_w(NULL, MODULE, TOX_SETTINGS_NODE_COUNT, 0);
if (!nodeCount)
{
tox_bootstrap_from_address(
- tox, isIPv4 ? "192.254.75.102" : "2607:5600:284::2", 33445,
+ tox, "192.254.75.102", 33445,
ToxBinAddress("951C88B7E75C867418ACDB5D273821372BB5BD652740BCDF623A4FA293E75D2F"));
+ if (!isIPv4Only)
+ tox_bootstrap_from_address(
+ tox, "2607:5600:284::2", 33445,
+ ToxBinAddress("951C88B7E75C867418ACDB5D273821372BB5BD652740BCDF623A4FA293E75D2F"));
}
else
{
char setting[MAX_PATH];
for (int i = 0; i < nodeCount; i++)
{
- mir_snprintf(setting, SIZEOF(setting), isIPv4 ? TOX_SETTINGS_NODE_IPV4 : TOX_SETTINGS_NODE_IPV6, i + 1);
+ mir_snprintf(setting, SIZEOF(setting), TOX_SETTINGS_NODE_IPV4, i + 1);
ptrA address(db_get_sa(NULL, MODULE, setting));
- if (address == NULL && !isIPv4)
- {
- mir_snprintf(setting, SIZEOF(setting), TOX_SETTINGS_NODE_IPV4, i + 1);
- address = db_get_sa(NULL, MODULE, setting);
- }
+ mir_snprintf(setting, SIZEOF(setting), TOX_SETTINGS_NODE_IPV6, i + 1);
+ ptrA addressv6(db_get_sa(NULL, MODULE, setting));
mir_snprintf(setting, SIZEOF(setting), TOX_SETTINGS_NODE_PORT, i + 1);
int port = db_get_w(NULL, MODULE, setting, 0);
mir_snprintf(setting, SIZEOF(setting), TOX_SETTINGS_NODE_PKEY, i + 1);
ptrA pubKey(db_get_sa(NULL, MODULE, setting));
- if (pubKey && address)
+ if (pubKey && address && port)
{
tox_bootstrap_from_address(tox, address, port, ToxBinAddress(pubKey));
}
+ if (!isIPv4Only && pubKey && addressv6 && port)
+ {
+ tox_bootstrap_from_address(tox, addressv6, port, ToxBinAddress(pubKey));
+ }
}
}
}