diff options
Diffstat (limited to 'protocols/AimOscar/src')
-rw-r--r-- | protocols/AimOscar/src/packets.cpp | 3 | ||||
-rw-r--r-- | protocols/AimOscar/src/proto.cpp | 6 | ||||
-rw-r--r-- | protocols/AimOscar/src/proto.h | 4 | ||||
-rw-r--r-- | protocols/AimOscar/src/utility.cpp | 13 |
4 files changed, 9 insertions, 17 deletions
diff --git a/protocols/AimOscar/src/packets.cpp b/protocols/AimOscar/src/packets.cpp index 3a4a5fc7f6..f4f44ab8bf 100644 --- a/protocols/AimOscar/src/packets.cpp +++ b/protocols/AimOscar/src/packets.cpp @@ -65,7 +65,7 @@ int aim_writetlvlong64(unsigned short type, unsigned __int64 value, unsigned sho int CAimProto::aim_sendflap(HANDLE hServerConn, char type,unsigned short length,const char *buf, unsigned short &seqno)
{
- EnterCriticalSection(&SendingMutex);
+ mir_cslock lck(SendingMutex);
const int slen = FLAP_SIZE + length;
char* obuf = (char*)alloca(slen);
flap_header *flap = (flap_header*)obuf;
@@ -76,7 +76,6 @@ int CAimProto::aim_sendflap(HANDLE hServerConn, char type,unsigned short length, memcpy(&obuf[FLAP_SIZE], buf, length);
int rlen= Netlib_Send(hServerConn, obuf, slen, 0);
if (rlen == SOCKET_ERROR) seqno--;
- LeaveCriticalSection(&SendingMutex);
return rlen >= 0 ? 0 : -1;
}
diff --git a/protocols/AimOscar/src/proto.cpp b/protocols/AimOscar/src/proto.cpp index d492744908..6bf94c926c 100644 --- a/protocols/AimOscar/src/proto.cpp +++ b/protocols/AimOscar/src/proto.cpp @@ -28,9 +28,6 @@ CAimProto::CAimProto(const char* aProtoName, const TCHAR* aUserName) : hChatNavEvent = CreateEvent(NULL, TRUE, FALSE, NULL);
hAdminEvent = CreateEvent(NULL, TRUE, FALSE, NULL);
- InitializeCriticalSection(&SendingMutex);
- InitializeCriticalSection(&connMutex);
-
CreateProtoService(PS_CREATEACCMGRUI, &CAimProto::SvcCreateAccMgrUI);
CreateProtoService(PS_GETMYAWAYMSG, &CAimProto::GetMyAwayMsg);
@@ -87,9 +84,6 @@ CAimProto::~CAimProto() Netlib_CloseHandle(m_hNetlibUser);
Netlib_CloseHandle(hNetlibPeer);
- DeleteCriticalSection(&SendingMutex);
- DeleteCriticalSection(&connMutex);
-
CloseHandle(hAvatarEvent);
CloseHandle(hChatNavEvent);
CloseHandle(hAdminEvent);
diff --git a/protocols/AimOscar/src/proto.h b/protocols/AimOscar/src/proto.h index 382d600348..4382514b16 100644 --- a/protocols/AimOscar/src/proto.h +++ b/protocols/AimOscar/src/proto.h @@ -108,8 +108,8 @@ struct CAimProto : public PROTO<CAimProto> int __cdecl OnGCMenuHook(WPARAM wParam,LPARAM lParam);
//====| Data |========================================================================
- CRITICAL_SECTION SendingMutex;
- CRITICAL_SECTION connMutex;
+ mir_cs SendingMutex;
+ mir_cs connMutex;
char* COOKIE;
int COOKIE_LENGTH;
diff --git a/protocols/AimOscar/src/utility.cpp b/protocols/AimOscar/src/utility.cpp index 00af4417d4..28678182a4 100644 --- a/protocols/AimOscar/src/utility.cpp +++ b/protocols/AimOscar/src/utility.cpp @@ -135,15 +135,14 @@ bool CAimProto::wait_conn(HANDLE& hConn, HANDLE& hEvent, unsigned short service) {
if (m_iStatus == ID_STATUS_OFFLINE)
return false;
-
- EnterCriticalSection(&connMutex);
- if (hConn == NULL && hServerConn)
{
- debugLogA("Starting Connection.");
- hConn = (HANDLE)1; //set so no additional service request attempts are made while aim is still processing the request
- aim_new_service_request(hServerConn, seqno, service) ;//general service connection!
+ mir_cslock lck(connMutex);
+ if (hConn == NULL && hServerConn) {
+ debugLogA("Starting Connection.");
+ hConn = (HANDLE)1; //set so no additional service request attempts are made while aim is still processing the request
+ aim_new_service_request(hServerConn, seqno, service);//general service connection!
+ }
}
- LeaveCriticalSection(&connMutex);
if (WaitForSingleObjectEx(hEvent, 10000, TRUE) != WAIT_OBJECT_0)
return false;
|