summaryrefslogtreecommitdiff
path: root/protocols/Tox/src/tox_proto.cpp
diff options
context:
space:
mode:
authorAlexander Lantsev <aunsane@gmail.com>2015-09-07 19:40:25 +0000
committerAlexander Lantsev <aunsane@gmail.com>2015-09-07 19:40:25 +0000
commited9fa764b873d1ae27ab98249a5d3bb31c253bdb (patch)
tree814b3f7b7fef7392bcb34039fd05da3a0f28c5b6 /protocols/Tox/src/tox_proto.cpp
parent935c3102e47f424ff2d493d48eef95101dde82da (diff)
Tox:
- change error message when tox core initialization is failed - trying to fix error with keepstatus reconnect git-svn-id: http://svn.miranda-ng.org/main/trunk@15297 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'protocols/Tox/src/tox_proto.cpp')
-rw-r--r--protocols/Tox/src/tox_proto.cpp18
1 files changed, 13 insertions, 5 deletions
diff --git a/protocols/Tox/src/tox_proto.cpp b/protocols/Tox/src/tox_proto.cpp
index b31d83f894..1718f9f0bc 100644
--- a/protocols/Tox/src/tox_proto.cpp
+++ b/protocols/Tox/src/tox_proto.cpp
@@ -1,10 +1,10 @@
#include "stdafx.h"
-CToxProto::CToxProto(const char* protoName, const TCHAR* userName) :
-PROTO<CToxProto>(protoName, userName),
-tox(NULL), toxAv(NULL), password(NULL),
-isTerminated(false), isConnected(false),
-hPollingThread(NULL), hOutDevice(NULL)
+CToxProto::CToxProto(const char* protoName, const TCHAR* userName)
+ : PROTO<CToxProto>(protoName, userName),
+ tox(NULL), toxAv(NULL), password(NULL),
+ isTerminated(false), isConnected(false),
+ hPollingThread(NULL), hOutDevice(NULL)
{
InitNetlib();
@@ -174,6 +174,8 @@ int CToxProto::SetStatus(int iNewStatus)
{
// logout
isTerminated = true;
+ WaitForSingleObject(hPollingThread, INFINITE);
+ hPollingThread = NULL;
if (!Miranda_Terminated())
{
@@ -192,6 +194,12 @@ int CToxProto::SetStatus(int iNewStatus)
if (old_status == ID_STATUS_OFFLINE && !IsOnline())
{
+ if (hPollingThread != NULL)
+ {
+ m_iDesiredStatus = old_status;
+ return 0;
+ }
+
// login
m_iStatus = ID_STATUS_CONNECTING;