diff options
Diffstat (limited to 'protocols/Telegram/src')
-rw-r--r-- | protocols/Telegram/src/proto.h | 2 | ||||
-rw-r--r-- | protocols/Telegram/src/server.cpp | 9 |
2 files changed, 9 insertions, 2 deletions
diff --git a/protocols/Telegram/src/proto.h b/protocols/Telegram/src/proto.h index 9e755fb1c6..acf288aeba 100644 --- a/protocols/Telegram/src/proto.h +++ b/protocols/Telegram/src/proto.h @@ -207,6 +207,8 @@ class CTelegramProto : public PROTO<CTelegramProto> CMStringA m_defaultEmoji; OBJLIST<TG_OWN_MESSAGE> m_arOwnMsg; + + mir_cs m_csRequests; OBJLIST<TG_REQUEST_BASE> m_arRequests; mir_cs m_csFiles; diff --git a/protocols/Telegram/src/server.cpp b/protocols/Telegram/src/server.cpp index f31e23f709..51da845681 100644 --- a/protocols/Telegram/src/server.cpp +++ b/protocols/Telegram/src/server.cpp @@ -176,6 +176,7 @@ void CTelegramProto::ProcessResponse(td::ClientManager::Response response) if (response.request_id) {
TG_REQUEST tmp(response.request_id, 0);
+ mir_cslock lck(m_csRequests);
auto *p = m_arRequests.find(&tmp);
if (p) {
p->Execute(this, response);
@@ -359,8 +360,10 @@ int CTelegramProto::SendQuery(TD::Function *pFunc, TG_QUERY_HANDLER pHandler) m_pClientManager->send(m_iClientId, queryId, TD::object_ptr<TD::Function>(pFunc));
- if (pHandler)
+ if (pHandler) {
+ mir_cslock lck(m_csRequests);
m_arRequests.insert(new TG_REQUEST(queryId, pHandler));
+ }
return queryId;
}
@@ -376,8 +379,10 @@ int CTelegramProto::SendQuery(TD::Function *pFunc, TG_QUERY_HANDLER_FULL pHandle m_pClientManager->send(m_iClientId, queryId, TD::object_ptr<TD::Function>(pFunc));
- if (pHandler)
+ if (pHandler) {
+ mir_cslock lck(m_csRequests);
m_arRequests.insert(new TG_REQUEST_FULL(queryId, pHandler, pUserInfo));
+ }
return queryId;
}
|