diff options
author | George Hazan <ghazan@miranda.im> | 2020-05-12 22:15:12 +0300 |
---|---|---|
committer | George Hazan <ghazan@miranda.im> | 2020-05-12 22:15:12 +0300 |
commit | e27e90cf6167d5d23a4458ae99479df6135a16b2 (patch) | |
tree | 308bbde868cf1586ead2d51d87c1c937f95ef986 /protocols/ICQ-WIM | |
parent | 8408d060b805d5c945ce519ff4e1f5f52b9b1038 (diff) |
ICQ-WIM: fix for restoring protocol status after hibernation
Diffstat (limited to 'protocols/ICQ-WIM')
-rw-r--r-- | protocols/ICQ-WIM/src/http.cpp | 11 | ||||
-rw-r--r-- | protocols/ICQ-WIM/src/proto.h | 1 | ||||
-rw-r--r-- | protocols/ICQ-WIM/src/server.cpp | 3 |
3 files changed, 13 insertions, 2 deletions
diff --git a/protocols/ICQ-WIM/src/http.cpp b/protocols/ICQ-WIM/src/http.cpp index abc2af5996..9816c0d314 100644 --- a/protocols/ICQ-WIM/src/http.cpp +++ b/protocols/ICQ-WIM/src/http.cpp @@ -22,6 +22,17 @@ #pragma comment(lib, "Rpcrt4.lib") +void CIcqProto::DropQueue() +{ + mir_cslock lck(m_csHttpQueue); + + while (m_arHttpQueue.getCount()) { + auto *pReq = m_arHttpQueue[0]; + m_arHttpQueue.remove(0); + delete pReq; + } +} + bool CIcqProto::IsQueueEmpty() { mir_cslock lck(m_csHttpQueue); diff --git a/protocols/ICQ-WIM/src/proto.h b/protocols/ICQ-WIM/src/proto.h index d48238a9d0..a30246ec19 100644 --- a/protocols/ICQ-WIM/src/proto.h +++ b/protocols/ICQ-WIM/src/proto.h @@ -349,6 +349,7 @@ class CIcqProto : public PROTO<CIcqProto> LIST<AsyncHttpRequest> m_arHttpQueue; void CalcHash(AsyncHttpRequest*); + void DropQueue(); bool ExecuteRequest(AsyncHttpRequest*); bool IsQueueEmpty(); void Push(MHttpRequest*); diff --git a/protocols/ICQ-WIM/src/server.cpp b/protocols/ICQ-WIM/src/server.cpp index 29528b9af1..68c4fecd05 100644 --- a/protocols/ICQ-WIM/src/server.cpp +++ b/protocols/ICQ-WIM/src/server.cpp @@ -579,8 +579,7 @@ void CIcqProto::ShutdownSession() debugLogA("CIcqProto::ShutdownSession"); // shutdown all resources - while (!IsQueueEmpty()) - Sleep(50); + DropQueue(); if (m_hWorkerThread) SetEvent(m_evRequestsQueue); |