summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--protocols/VKontakte/src/misc.cpp2
-rw-r--r--protocols/VKontakte/src/version.h2
-rw-r--r--protocols/VKontakte/src/vk_files.cpp4
-rw-r--r--protocols/VKontakte/src/vk_proto.cpp11
-rw-r--r--protocols/VKontakte/src/vk_queue.cpp5
5 files changed, 17 insertions, 7 deletions
diff --git a/protocols/VKontakte/src/misc.cpp b/protocols/VKontakte/src/misc.cpp
index 70c28659e5..9576d09224 100644
--- a/protocols/VKontakte/src/misc.cpp
+++ b/protocols/VKontakte/src/misc.cpp
@@ -97,6 +97,7 @@ AsyncHttpRequest::AsyncHttpRequest(CVkProto *ppro, int iRequestType, LPCSTR _url
{
cbSize = sizeof(NETLIBHTTPREQUEST);
m_bApiReq = true;
+ bIsMainConn = false;
AddHeader("Connection", "keep-alive");
AddHeader("Accept-Encoding", "booo");
@@ -119,7 +120,6 @@ AsyncHttpRequest::AsyncHttpRequest(CVkProto *ppro, int iRequestType, LPCSTR _url
pUserInfo = NULL;
m_iRetry = MAX_RETRIES;
bNeedsRestart = false;
- bIsMainConn = false;
}
AsyncHttpRequest::~AsyncHttpRequest()
diff --git a/protocols/VKontakte/src/version.h b/protocols/VKontakte/src/version.h
index 66ff82d699..d82be5d6f4 100644
--- a/protocols/VKontakte/src/version.h
+++ b/protocols/VKontakte/src/version.h
@@ -1,7 +1,7 @@
#define __MAJOR_VERSION 0
#define __MINOR_VERSION 1
#define __RELEASE_NUM 0
-#define __BUILD_NUM 40
+#define __BUILD_NUM 41
#include <stdver.h>
diff --git a/protocols/VKontakte/src/vk_files.cpp b/protocols/VKontakte/src/vk_files.cpp
index 9679d3e9b4..ba40af49e8 100644
--- a/protocols/VKontakte/src/vk_files.cpp
+++ b/protocols/VKontakte/src/vk_files.cpp
@@ -230,10 +230,10 @@ void CVkProto::OnReciveUploadServer(NETLIBHTTPREQUEST *reply, AsyncHttpRequest *
pUploadReq->pData = pData;
pData += DataBegin.GetLength();
- size_t szBytes = fread(pData, 1, iFileLen, pFile);
+ long lBytes = fread(pData, 1, iFileLen, pFile);
fclose(pFile);
- if (szBytes != iFileLen) {
+ if (lBytes != iFileLen) {
SendFileFiled(fup, _T("ErrorReadFile"));
return;
}
diff --git a/protocols/VKontakte/src/vk_proto.cpp b/protocols/VKontakte/src/vk_proto.cpp
index e952478e8a..fffb4eafed 100644
--- a/protocols/VKontakte/src/vk_proto.cpp
+++ b/protocols/VKontakte/src/vk_proto.cpp
@@ -551,7 +551,7 @@ void CVkProto::OnSendMessage(NETLIBHTTPREQUEST *reply, AsyncHttpRequest *pReq)
int CVkProto::SetStatus(int iNewStatus)
{
- debugLogA("CVkProto::SetStatus iNewStatus = %d, m_iStatus = %d, m_iDesiredStatus = %d", iNewStatus, m_iStatus, m_iDesiredStatus);
+ debugLogA("CVkProto::SetStatus iNewStatus = %d, m_iStatus = %d, m_iDesiredStatus = %d m_hWorkerThread = %d", iNewStatus, m_iStatus, m_iDesiredStatus, m_hWorkerThread == NULL? 0 : 1 );
if (m_iDesiredStatus == iNewStatus || iNewStatus == ID_STATUS_IDLE)
return 0;
@@ -567,20 +567,27 @@ int CVkProto::SetStatus(int iNewStatus)
m_iStatus = m_iDesiredStatus = ID_STATUS_OFFLINE;
ProtoBroadcastAck(NULL, ACKTYPE_STATUS, ACKRESULT_SUCCESS, (HANDLE)oldStatus, m_iStatus);
+ debugLogA("CVkProto::SetStatus (1) iNewStatus = %d, m_iStatus = %d, m_iDesiredStatus = %d oldStatus = %d", iNewStatus, m_iStatus, m_iDesiredStatus, oldStatus);
}
else if (m_hWorkerThread == NULL && !(m_iStatus >= ID_STATUS_CONNECTING && m_iStatus < ID_STATUS_CONNECTING + MAX_CONNECT_RETRIES)) {
m_iStatus = ID_STATUS_CONNECTING;
ProtoBroadcastAck(NULL, ACKTYPE_STATUS, ACKRESULT_SUCCESS, (HANDLE)oldStatus, m_iStatus);
+ debugLogA("CVkProto::SetStatus (2) iNewStatus = %d, m_iStatus = %d, m_iDesiredStatus = %d oldStatus = %d", iNewStatus, m_iStatus, m_iDesiredStatus, oldStatus);
m_hWorkerThread = ForkThreadEx(&CVkProto::WorkerThread, 0, NULL);
}
- else if (IsOnline())
+ else if (IsOnline()){
+ debugLogA("CVkProto::SetStatus (3) iNewStatus = %d, m_iStatus = %d, m_iDesiredStatus = %d oldStatus = %d", iNewStatus, m_iStatus, m_iDesiredStatus, oldStatus);
SetServerStatus(iNewStatus);
+ }
else {
+ debugLogA("CVkProto::SetStatus (4) iNewStatus = %d, m_iStatus = %d, m_iDesiredStatus = %d oldStatus = %d", iNewStatus, m_iStatus, m_iDesiredStatus, oldStatus);
ProtoBroadcastAck(NULL, ACKTYPE_STATUS, ACKRESULT_SUCCESS, (HANDLE)oldStatus, m_iStatus);
if (!(m_iStatus >= ID_STATUS_CONNECTING && m_iStatus < ID_STATUS_CONNECTING + MAX_CONNECT_RETRIES))
m_iDesiredStatus = m_iStatus;
+ debugLogA("CVkProto::SetStatus (5) iNewStatus = %d, m_iStatus = %d, m_iDesiredStatus = %d oldStatus = %d", iNewStatus, m_iStatus, m_iDesiredStatus, oldStatus);
}
+ debugLogA("CVkProto::SetStatus (ret) iNewStatus = %d, m_iStatus = %d, m_iDesiredStatus = %d oldStatus = %d", iNewStatus, m_iStatus, m_iDesiredStatus, oldStatus);
return 0;
}
diff --git a/protocols/VKontakte/src/vk_queue.cpp b/protocols/VKontakte/src/vk_queue.cpp
index 72c9c4bcc8..54a33e135a 100644
--- a/protocols/VKontakte/src/vk_queue.cpp
+++ b/protocols/VKontakte/src/vk_queue.cpp
@@ -111,6 +111,7 @@ void CVkProto::WorkerThread(void*)
}
while (true) {
+ debugLogA("CVkProto::WorkerThread: _while begin");
WaitForSingleObject(m_evRequestsQueue, 1000);
if (m_bTerminated)
break;
@@ -118,6 +119,7 @@ void CVkProto::WorkerThread(void*)
AsyncHttpRequest *pReq;
bool need_sleep = false;
while (true) {
+ debugLogA("CVkProto::WorkerThread: while begin");
{
mir_cslock lck(m_csRequestsQueue);
if (m_arRequestsQueue.getCount() == 0)
@@ -132,8 +134,9 @@ void CVkProto::WorkerThread(void*)
ExecuteRequest(pReq);
if (need_sleep) // There can be maximum 3 requests to API methods per second from a client
Sleep(330); // (c) https://vk.com/dev/api_requests
- debugLogA("CVkProto::WorkerThread: while");
+ debugLogA("CVkProto::WorkerThread: while end");
}
+ debugLogA("CVkProto::WorkerThread: _while end");
}
m_hWorkerThread = 0;