summaryrefslogtreecommitdiff
path: root/protocols/Tox/src/tox_network.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'protocols/Tox/src/tox_network.cpp')
-rw-r--r--protocols/Tox/src/tox_network.cpp38
1 files changed, 19 insertions, 19 deletions
diff --git a/protocols/Tox/src/tox_network.cpp b/protocols/Tox/src/tox_network.cpp
index 03134d1034..956378d9c4 100644
--- a/protocols/Tox/src/tox_network.cpp
+++ b/protocols/Tox/src/tox_network.cpp
@@ -12,9 +12,9 @@ void CToxProto::BootstrapNode(const char *address, int port, const char *hexKey)
ToxBinAddress binKey(hexKey, TOX_PUBLIC_KEY_SIZE * 2);
TOX_ERR_BOOTSTRAP error;
if (!tox_bootstrap(toxThread->tox, address, port, binKey, &error))
- debugLogA(__FUNCTION__ ": failed to bootstrap node %s:%d \"%s\" (%d)", address, port, hexKey, error);
+ logger->Log(__FUNCTION__ ": failed to bootstrap node %s:%d \"%s\" (%d)", address, port, hexKey, error);
if (!tox_add_tcp_relay(toxThread->tox, address, port, binKey, &error))
- debugLogA(__FUNCTION__ ": failed to add tcp relay %s:%d \"%s\" (%d)", address, port, hexKey, error);
+ logger->Log(__FUNCTION__ ": failed to add tcp relay %s:%d \"%s\" (%d)", address, port, hexKey, error);
}
void CToxProto::BootstrapNodesFromDb(bool isIPv6)
@@ -78,7 +78,7 @@ void CToxProto::BootstrapNodesFromIni(bool isIPv6)
void CToxProto::BootstrapNodes()
{
- debugLogA(__FUNCTION__": bootstraping DHT");
+ logger->Log(__FUNCTION__": bootstraping DHT");
bool isIPv6 = getBool("EnableIPv6", 0);
BootstrapNodesFromDb(isIPv6);
BootstrapNodesFromIni(isIPv6);
@@ -89,20 +89,20 @@ void CToxProto::TryConnect()
if (tox_self_get_connection_status(toxThread->tox) != TOX_CONNECTION_NONE)
{
toxThread->isConnected = true;
- debugLogA(__FUNCTION__": successfuly connected to DHT");
+ logger->Log(__FUNCTION__": successfuly connected to DHT");
ForkThread(&CToxProto::LoadFriendList, NULL);
m_iStatus = m_iDesiredStatus;
ProtoBroadcastAck(NULL, ACKTYPE_STATUS, ACKRESULT_SUCCESS, (HANDLE)ID_STATUS_CONNECTING, m_iStatus);
tox_self_set_status(toxThread->tox, MirandaToToxStatus(m_iStatus));
- debugLogA(__FUNCTION__": changing status from %i to %i", ID_STATUS_CONNECTING, m_iDesiredStatus);
+ logger->Log(__FUNCTION__": changing status from %i to %i", ID_STATUS_CONNECTING, m_iDesiredStatus);
}
else if (m_iStatus++ > TOX_MAX_CONNECT_RETRIES)
{
SetStatus(ID_STATUS_OFFLINE);
ProtoBroadcastAck(NULL, ACKTYPE_LOGIN, ACKRESULT_FAILED, (HANDLE)NULL, LOGINERR_NONETWORK);
- debugLogA(__FUNCTION__": failed to connect to DHT");
+ logger->Log(__FUNCTION__": failed to connect to DHT");
}
}
@@ -116,7 +116,7 @@ void CToxProto::CheckConnection(int &retriesCount)
{
if (retriesCount < TOX_MAX_DISCONNECT_RETRIES)
{
- debugLogA(__FUNCTION__": restored connection with DHT");
+ logger->Log(__FUNCTION__": restored connection with DHT");
retriesCount = TOX_MAX_DISCONNECT_RETRIES;
}
}
@@ -125,7 +125,7 @@ void CToxProto::CheckConnection(int &retriesCount)
if (retriesCount == TOX_MAX_DISCONNECT_RETRIES)
{
retriesCount--;
- debugLogA(__FUNCTION__": lost connection with DHT");
+ logger->Log(__FUNCTION__": lost connection with DHT");
}
else if (retriesCount % 50 == 0)
{
@@ -135,21 +135,21 @@ void CToxProto::CheckConnection(int &retriesCount)
else if (!(--retriesCount))
{
toxThread->isConnected = false;
- debugLogA(__FUNCTION__": disconnected from DHT");
+ logger->Log(__FUNCTION__": disconnected from DHT");
SetStatus(ID_STATUS_OFFLINE);
}
}
}
-void DoTox(ToxThreadData *toxThread)
+void DoTox(ToxThreadData &toxThread)
{
{
- mir_cslock lock(toxThread->toxLock);
- tox_iterate(toxThread->tox);
- if (toxThread->toxAv)
- toxav_do(toxThread->toxAv);
+ mir_cslock lock(toxThread.toxLock);
+ tox_iterate(toxThread.tox);
+ if (toxThread.toxAv)
+ toxav_do(toxThread.toxAv);
}
- uint32_t interval = tox_iteration_interval(toxThread->tox);
+ uint32_t interval = tox_iteration_interval(toxThread.tox);
Sleep(interval);
}
@@ -158,13 +158,13 @@ void CToxProto::PollingThread(void*)
ToxThreadData toxThread;
this->toxThread = &toxThread;
- debugLogA(__FUNCTION__": entering");
+ logger->Log(__FUNCTION__": entering");
if (!InitToxCore(&toxThread))
{
SetStatus(ID_STATUS_OFFLINE);
ProtoBroadcastAck(NULL, ACKTYPE_LOGIN, ACKRESULT_FAILED, (HANDLE)NULL, LOGINERR_WRONGPASSWORD);
- debugLogA(__FUNCTION__": leaving");
+ logger->Log(__FUNCTION__": leaving");
return;
}
@@ -175,11 +175,11 @@ void CToxProto::PollingThread(void*)
while (!toxThread.isTerminated)
{
CheckConnection(retriesCount);
- DoTox(&toxThread);
+ DoTox(toxThread);
}
UninitToxCore(&toxThread);
toxThread.isConnected = false;
- debugLogA(__FUNCTION__": leaving");
+ logger->Log(__FUNCTION__": leaving");
} \ No newline at end of file