diff options
author | Alexander Lantsev <aunsane@gmail.com> | 2015-02-18 19:24:48 +0000 |
---|---|---|
committer | Alexander Lantsev <aunsane@gmail.com> | 2015-02-18 19:24:48 +0000 |
commit | 40453965455818d568bf90224b828c3f72b2606d (patch) | |
tree | 896abd9c140e7ccce2302937788ef14027d0142f /protocols/Tox/src/tox_network.cpp | |
parent | a8bb7b8d1f606b887c614d6200840fffb1bd48aa (diff) |
Tox:
- code cleaning
- removed unneeded dependencies
- posible fix for disconnect
git-svn-id: http://svn.miranda-ng.org/main/trunk@12183 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'protocols/Tox/src/tox_network.cpp')
-rw-r--r-- | protocols/Tox/src/tox_network.cpp | 27 |
1 files changed, 13 insertions, 14 deletions
diff --git a/protocols/Tox/src/tox_network.cpp b/protocols/Tox/src/tox_network.cpp index 72f090fe76..86afc17607 100644 --- a/protocols/Tox/src/tox_network.cpp +++ b/protocols/Tox/src/tox_network.cpp @@ -5,12 +5,7 @@ bool CToxProto::IsOnline() return isConnected && m_iStatus > ID_STATUS_OFFLINE;
}
-bool CToxProto::IsOffline()
-{
- return !isConnected && m_iStatus == ID_STATUS_OFFLINE;
-}
-
-void CToxProto::BootstrapDht()
+void CToxProto::BootstrapNodes()
{
debugLogA("CToxProto::BootstrapDht: bootstraping DHT");
@@ -21,9 +16,6 @@ void CToxProto::BootstrapDht() tox_bootstrap_from_address(
tox, isIPv4 ? "192.254.75.102" : "2607:5600:284::2", 33445,
ToxBinAddress("951C88B7E75C867418ACDB5D273821372BB5BD652740BCDF623A4FA293E75D2F"));
- tox_bootstrap_from_address(
- tox, "104.219.184.206", 443,
- ToxBinAddress("8CD087E31C67568103E8C2A28653337E90E6B8EDA0D765D57C6B5172B4F1F04C"));
}
else
{
@@ -91,11 +83,18 @@ void CToxProto::CheckConnection(int &retriesCount) retriesCount = TOX_MAX_DISCONNECT_RETRIES;
}
}
- else if (!(--retriesCount))
+ else
{
- isConnected = false;
- debugLogA("CToxProto::CheckConnection: disconnected from DHT");
- SetStatus(ID_STATUS_OFFLINE);
+ if (--retriesCount == TOX_MAX_DISCONNECT_RETRIES - 1)
+ {
+ BootstrapNodes();
+ }
+ else if (!(--retriesCount))
+ {
+ isConnected = false;
+ debugLogA("CToxProto::CheckConnection: disconnected from DHT");
+ SetStatus(ID_STATUS_OFFLINE);
+ }
}
}
}
@@ -124,7 +123,7 @@ void CToxProto::PollingThread(void*) int retriesCount = TOX_MAX_DISCONNECT_RETRIES;
isConnected = false;
- BootstrapDht();
+ BootstrapNodes();
while (!isTerminated)
{
|