diff options
author | Alexander Lantsev <aunsane@gmail.com> | 2015-03-05 18:01:07 +0000 |
---|---|---|
committer | Alexander Lantsev <aunsane@gmail.com> | 2015-03-05 18:01:07 +0000 |
commit | 0611ac72c7020b46466309c19622afe0fb3bc122 (patch) | |
tree | fb5df43af76edebba590449c1b54922d91b07707 /protocols/Tox/src/tox_network.cpp | |
parent | 4492ddd696ed03f015c7a2de457d0aff6f96de62 (diff) |
Tox:
- removed dns3 servers from code
- cv2pdb moved to tools
git-svn-id: http://svn.miranda-ng.org/main/trunk@12330 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'protocols/Tox/src/tox_network.cpp')
-rw-r--r-- | protocols/Tox/src/tox_network.cpp | 26 |
1 files changed, 15 insertions, 11 deletions
diff --git a/protocols/Tox/src/tox_network.cpp b/protocols/Tox/src/tox_network.cpp index 109cedbf99..52c66120b9 100644 --- a/protocols/Tox/src/tox_network.cpp +++ b/protocols/Tox/src/tox_network.cpp @@ -5,9 +5,16 @@ bool CToxProto::IsOnline() return isConnected && m_iStatus > ID_STATUS_OFFLINE;
}
-int CToxProto::BootstrapNodesFromDb(bool isIPv6)
+void CToxProto::BootstrapNode(const char *address, int port, const uint8_t *pubKey)
+{
+ if (!tox_bootstrap_from_address(tox, address, port, pubKey))
+ {
+ debugLogA("CToxProto::BootstrapNode: failed to bootstrap node %s:%d (%s)", address, port, (const char*)ToxHexAddress(pubKey));
+ }
+}
+
+void CToxProto::BootstrapNodesFromDb(bool isIPv6)
{
- int nodesLoaded = 0;
char module[MAX_PATH];
mir_snprintf(module, SIZEOF(module), "%s_NODES", m_szModuleName);
int nodeCount = db_get_w(NULL, module, TOX_SETTINGS_NODE_COUNT, 0);
@@ -21,22 +28,20 @@ int CToxProto::BootstrapNodesFromDb(bool isIPv6) mir_snprintf(setting, SIZEOF(setting), TOX_SETTINGS_NODE_PORT, i);
int port = db_get_w(NULL, module, setting, 33445);
mir_snprintf(setting, SIZEOF(setting), TOX_SETTINGS_NODE_PKEY, i);
- ptrA pubKey(db_get_sa(NULL, module, setting));
- nodesLoaded += tox_bootstrap_from_address(tox, address, port, ToxBinAddress(pubKey));
+ ToxBinAddress pubKey(ptrA(db_get_sa(NULL, module, setting)));
+ BootstrapNode(address, port, pubKey);
if (isIPv6)
{
mir_snprintf(setting, SIZEOF(setting), TOX_SETTINGS_NODE_IPV6, i);
address = db_get_sa(NULL, module, setting);
- nodesLoaded += tox_bootstrap_from_address(tox, address, port, ToxBinAddress(pubKey));
+ BootstrapNode(address, port, pubKey);
}
}
}
- return nodesLoaded;
}
-int CToxProto::BootstrapNodesFromIni(bool isIPv6)
+void CToxProto::BootstrapNodesFromIni(bool isIPv6)
{
- int nodesLoaded = 0;
if (IsFileExists((TCHAR*)VARST(_T(TOX_INI_PATH))))
{
char fileName[MAX_PATH];
@@ -54,18 +59,17 @@ int CToxProto::BootstrapNodesFromIni(bool isIPv6) int port = GetPrivateProfileIntA(section, "Port", 33445, fileName);
GetPrivateProfileStringA(section, "PubKey", NULL, value, SIZEOF(value), fileName);
ToxBinAddress pubKey(value);
- nodesLoaded += tox_bootstrap_from_address(tox, address, port, pubKey);
+ BootstrapNode(address, port, pubKey);
if (isIPv6)
{
GetPrivateProfileStringA(section, "IPv6", NULL, value, SIZEOF(value), fileName);
address = mir_strdup(value);
- nodesLoaded += tox_bootstrap_from_address(tox, address, port, pubKey);
+ BootstrapNode(address, port, pubKey);
}
}
section += strlen(section) + 1;
}
}
- return nodesLoaded;
}
void CToxProto::BootstrapNodes()
|