summaryrefslogtreecommitdiff
path: root/protocols/VKontakte/src
diff options
context:
space:
mode:
Diffstat (limited to 'protocols/VKontakte/src')
-rw-r--r--protocols/VKontakte/src/misc.cpp6
-rw-r--r--protocols/VKontakte/src/vk_proto.cpp2
-rw-r--r--protocols/VKontakte/src/vk_proto.h3
3 files changed, 7 insertions, 4 deletions
diff --git a/protocols/VKontakte/src/misc.cpp b/protocols/VKontakte/src/misc.cpp
index 756f74e190..8d3a6c1295 100644
--- a/protocols/VKontakte/src/misc.cpp
+++ b/protocols/VKontakte/src/misc.cpp
@@ -144,6 +144,8 @@ char* ExpUrlEncode(const char *szUrl, bool strict)
/////////////////////////////////////////////////////////////////////////////////////////
+ULONG AsyncHttpRequest::m_reqCount = 0;
+
AsyncHttpRequest::AsyncHttpRequest()
{
cbSize = sizeof(NETLIBHTTPREQUEST);
@@ -156,7 +158,7 @@ AsyncHttpRequest::AsyncHttpRequest()
bIsMainConn = false;
m_pFunc = NULL;
bExpUrlEncode = false;
- m_time = time(NULL);
+ m_reqNum = ::InterlockedIncrement(&m_reqCount);
m_priority = rpLow;
}
@@ -188,7 +190,7 @@ AsyncHttpRequest::AsyncHttpRequest(CVkProto *ppro, int iRequestType, LPCSTR _url
pUserInfo = NULL;
m_iRetry = MAX_RETRIES;
bNeedsRestart = false;
- m_time = time(NULL);
+ m_reqNum = ::InterlockedIncrement(&m_reqCount);
m_priority = rpPriority;
}
diff --git a/protocols/VKontakte/src/vk_proto.cpp b/protocols/VKontakte/src/vk_proto.cpp
index a3dc5f01c8..2c13cc782a 100644
--- a/protocols/VKontakte/src/vk_proto.cpp
+++ b/protocols/VKontakte/src/vk_proto.cpp
@@ -25,7 +25,7 @@ static int sttCompareProtocols(const CVkProto *p1, const CVkProto *p2)
static int sttCompareAsyncHttpRequest(const AsyncHttpRequest *p1, const AsyncHttpRequest *p2)
{
if (p1->m_priority == p2->m_priority)
- return (int)p1->m_time - (int)p2->m_time;
+ return (int)p1->m_reqNum - (int)p2->m_reqNum;
return (int)p2->m_priority - (int)p1->m_priority;
}
diff --git a/protocols/VKontakte/src/vk_proto.h b/protocols/VKontakte/src/vk_proto.h
index 17c922a266..933992a5f3 100644
--- a/protocols/VKontakte/src/vk_proto.h
+++ b/protocols/VKontakte/src/vk_proto.h
@@ -56,7 +56,8 @@ struct AsyncHttpRequest : public NETLIBHTTPREQUEST, public MZeroedObject
void *pUserInfo;
int m_iRetry;
RequestPriority m_priority;
- time_t m_time;
+ static ULONG m_reqCount;
+ ULONG m_reqNum;
bool m_bApiReq;
bool bExpUrlEncode;
bool bNeedsRestart, bIsMainConn;