summaryrefslogtreecommitdiff
path: root/protocols
diff options
context:
space:
mode:
Diffstat (limited to 'protocols')
-rw-r--r--protocols/MRA/src/MraAvatars.cpp13
-rw-r--r--protocols/MRA/src/MraProto.cpp3
-rw-r--r--protocols/MRA/src/MraProto.h1
3 files changed, 10 insertions, 7 deletions
diff --git a/protocols/MRA/src/MraAvatars.cpp b/protocols/MRA/src/MraAvatars.cpp
index 33907a5da0..344b754391 100644
--- a/protocols/MRA/src/MraAvatars.cpp
+++ b/protocols/MRA/src/MraAvatars.cpp
@@ -109,18 +109,19 @@ void CMraProto::MraAvatarsQueueClear(HANDLE hAvatarsQueueHandle)
}
}
-void CMraProto::MraAvatarsQueueDestroy(HANDLE hAvatarsQueueHandle)
+void CMraProto::MraAvatarsQueueSuspend(HANDLE hAvatarsQueueHandle)
{
- if ( !hAvatarsQueueHandle)
- return;
-
MRA_AVATARS_QUEUE *pmraaqAvatarsQueue = (MRA_AVATARS_QUEUE*)hAvatarsQueueHandle;
-
InterlockedExchange((volatile LONG*)&pmraaqAvatarsQueue->bIsRunning, FALSE);
SetEvent(pmraaqAvatarsQueue->hThreadEvent);
+}
- WaitForMultipleObjects(pmraaqAvatarsQueue->iThreadsCount, (HANDLE*)&pmraaqAvatarsQueue->hThread[0], TRUE, (WAIT_FOR_THREAD_TIMEOUT*1000));
+void CMraProto::MraAvatarsQueueDestroy(HANDLE hAvatarsQueueHandle)
+{
+ if ( !hAvatarsQueueHandle)
+ return;
+ MRA_AVATARS_QUEUE *pmraaqAvatarsQueue = (MRA_AVATARS_QUEUE*)hAvatarsQueueHandle;
if (InterlockedExchangeAdd((volatile LONG*)&pmraaqAvatarsQueue->lThreadsRunningCount, 0))
while (InterlockedExchangeAdd((volatile LONG*)&pmraaqAvatarsQueue->lThreadsRunningCount, 0))
SleepEx(100, TRUE);
diff --git a/protocols/MRA/src/MraProto.cpp b/protocols/MRA/src/MraProto.cpp
index 79349466bf..e050882e99 100644
--- a/protocols/MRA/src/MraProto.cpp
+++ b/protocols/MRA/src/MraProto.cpp
@@ -71,6 +71,7 @@ CMraProto::~CMraProto()
if (m_heNudgeReceived)
DestroyHookableEvent(m_heNudgeReceived);
+ MraAvatarsQueueDestroy(hAvatarsQueueHandle);
MraMPopSessionQueueDestroy(hMPopSessionQueue);
MraFilesQueueDestroy(hFilesQueueHandle);
MraSendQueueDestroy(hSendQueueHandle);
@@ -123,7 +124,7 @@ int CMraProto::OnModulesLoaded(WPARAM, LPARAM)
int CMraProto::OnPreShutdown(WPARAM, LPARAM)
{
SetStatus(ID_STATUS_OFFLINE);
- MraAvatarsQueueDestroy(hAvatarsQueueHandle); hAvatarsQueueHandle = NULL;
+ MraAvatarsQueueSuspend(hAvatarsQueueHandle);
return 0;
}
diff --git a/protocols/MRA/src/MraProto.h b/protocols/MRA/src/MraProto.h
index 8ed9b1696b..4e364ccc2f 100644
--- a/protocols/MRA/src/MraProto.h
+++ b/protocols/MRA/src/MraProto.h
@@ -332,6 +332,7 @@ struct CMraProto : public PROTO<CMraProto>
DWORD MraAvatarsQueueInitialize(HANDLE *phAvatarsQueueHandle);
void MraAvatarsQueueClear(HANDLE hAvatarsQueueHandle);
+ void MraAvatarsQueueSuspend(HANDLE hAvatarsQueueHandle);
void MraAvatarsQueueDestroy(HANDLE hAvatarsQueueHandle);
DWORD MraAvatarsQueueAdd(HANDLE hAvatarsQueueHandle, DWORD dwFlags, HANDLE hContact, DWORD *pdwAvatarsQueueID);
bool MraAvatarsGetContactTime (HANDLE hContact, LPSTR lpszValueName, SYSTEMTIME *pstTime);