diff options
author | Alexander Lantsev <aunsane@gmail.com> | 2014-08-17 17:26:18 +0000 |
---|---|---|
committer | Alexander Lantsev <aunsane@gmail.com> | 2014-08-17 17:26:18 +0000 |
commit | bf23720e7c1d7de70d7d99167a42783f08ef8b17 (patch) | |
tree | aa89f34bb46da1f7f66062d6f25a4ac2a103cb9b /protocols/Tox/src/tox_account.cpp | |
parent | a9276f9db53affa2acbd8bc3f435285c1b838f87 (diff) |
Tox:
- fixed tox id convertation
- fixed tox profile load in first start
- fixed polling thread
git-svn-id: http://svn.miranda-ng.org/main/trunk@10215 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'protocols/Tox/src/tox_account.cpp')
-rw-r--r-- | protocols/Tox/src/tox_account.cpp | 48 |
1 files changed, 18 insertions, 30 deletions
diff --git a/protocols/Tox/src/tox_account.cpp b/protocols/Tox/src/tox_account.cpp index a517673398..b4871425d2 100644 --- a/protocols/Tox/src/tox_account.cpp +++ b/protocols/Tox/src/tox_account.cpp @@ -49,6 +49,8 @@ void CToxProto::InitToxCore() void CToxProto::UninitToxCore()
{
+ isTerminated = isConnected = false;
+
SaveToxData();
tox_kill(tox);
@@ -68,10 +70,8 @@ void CToxProto::DoBootstrap() void CToxProto::DoTox()
{
- uint32_t interval = 1000;
+ uint32_t interval = 50;
{
- //mir_cslock lock(tox_lock);
-
tox_do(tox);
interval = tox_do_interval(tox);
}
@@ -81,42 +81,30 @@ void CToxProto::DoTox() void CToxProto::PollingThread(void*)
{
debugLogA("CToxProto::PollingThread: entering");
-
+
while (!isTerminated)
{
DoTox();
- }
-
- debugLogA("CToxProto::PollingThread: leaving");
-}
-
-void CToxProto::ConnectionThread(void*)
-{
- debugLogA("CToxProto::ConnectionThread: entering");
-
- while (!isTerminated && !isConnected)
- {
- DoBootstrap();
- if (tox_isconnected(tox))
+ if (!isConnected)
{
- isConnected = true;
+ if (tox_isconnected(tox))
+ {
+ isConnected = true;
- LoadContactList();
+ LoadContactList();
- m_iStatus = m_iDesiredStatus = ID_STATUS_ONLINE;
- ProtoBroadcastAck(NULL, ACKTYPE_STATUS, ACKRESULT_SUCCESS, (HANDLE)ID_STATUS_CONNECTING, m_iStatus);
+ m_iStatus = m_iDesiredStatus = ID_STATUS_ONLINE;
+ ProtoBroadcastAck(NULL, ACKTYPE_STATUS, ACKRESULT_SUCCESS, (HANDLE)ID_STATUS_CONNECTING, m_iStatus);
- break;
+ debugLogA("CToxProto::PollingThread: successfuly connected to DHT");
+ }
+ else
+ {
+ DoBootstrap();
+ }
}
-
- DoTox();
}
- debugLogA("CToxProto::ConnectionThread: leaving");
-
- if (!isTerminated && isConnected)
- {
- poolingThread = ForkThreadEx(&CToxProto::PollingThread, 0, NULL);
- }
+ debugLogA("CToxProto::PollingThread: leaving");
}
\ No newline at end of file |