aboutsummaryrefslogtreecommitdiff
path: root/src/trinityrealm/AuthSocket.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/trinityrealm/AuthSocket.cpp')
-rw-r--r--src/trinityrealm/AuthSocket.cpp33
1 files changed, 17 insertions, 16 deletions
diff --git a/src/trinityrealm/AuthSocket.cpp b/src/trinityrealm/AuthSocket.cpp
index 3dc6b3a5c28..9933a237981 100644
--- a/src/trinityrealm/AuthSocket.cpp
+++ b/src/trinityrealm/AuthSocket.cpp
@@ -1,7 +1,7 @@
/*
- * Copyright (C) 2005-2008 MaNGOS <http://www.mangosproject.org/>
+ * Copyright (C) 2005-2009 MaNGOS <http://getmangos.com/>
*
- * Copyright (C) 2008 Trinity <http://www.trinitycore.org/>
+ * Copyright (C) 2008-2009 Trinity <http://www.trinitycore.org/>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -21,17 +21,19 @@
/** \file
\ingroup realmd
*/
+#include <openssl/md5.h>
#include "Common.h"
+#include "Auth/Sha1.h"
+#include "Config/ConfigEnv.h"
#include "Database/DatabaseEnv.h"
+
+#include "AuthCodes.h"
+#include "AuthSocket.h"
#include "ByteBuffer.h"
-#include "Config/ConfigEnv.h"
#include "Log.h"
#include "RealmList.h"
-#include "AuthSocket.h"
-#include "AuthCodes.h"
-#include <openssl/md5.h>
-#include "Auth/Sha1.h"
+
//#include "Util.h" -- for commented utf8ToUpperOnlyLatin
extern RealmList m_realmList;
@@ -173,7 +175,7 @@ typedef struct AuthHandler
#endif
/// Launch a thread to transfer a patch to the client
-class PatcherRunnable: public ZThread::Runnable
+class PatcherRunnable: public ACE_Based::Runnable
{
public:
PatcherRunnable(class AuthSocket *);
@@ -236,7 +238,8 @@ AuthSocket::AuthSocket(ISocketHandler &h) : TcpSocket(h)
/// Close patch file descriptor before leaving
AuthSocket::~AuthSocket()
{
- ZThread::Guard<ZThread::Mutex> g(patcherLock);
+ ACE_Guard<ACE_Thread_Mutex> g(patcherLock);
+
if(pPatch)
fclose(pPatch);
}
@@ -912,7 +915,7 @@ bool AuthSocket::_HandleXferResume()
ibuf.Read((char*)&start,sizeof(start));
fseek(pPatch,start,0);
- ZThread::Thread u(new PatcherRunnable(this));
+ ACE_Based::Thread u(*new PatcherRunnable(this));
return true;
}
@@ -924,7 +927,6 @@ bool AuthSocket::_HandleXferCancel()
///- Close and delete the socket
ibuf.Remove(1); //clear input buffer
- //ZThread::Thread::sleep(15);
SetCloseAndDelete();
return true;
@@ -946,8 +948,7 @@ bool AuthSocket::_HandleXferAccept()
ibuf.Remove(1); //clear input buffer
fseek(pPatch,0,0);
- ZThread::Thread u(new PatcherRunnable(this));
-
+ ACE_Based::Thread u(*new PatcherRunnable(this));
return true;
}
@@ -965,7 +966,8 @@ PatcherRunnable::PatcherRunnable(class AuthSocket * as)
/// Send content of patch file to the client
void PatcherRunnable::run()
{
- ZThread::Guard<ZThread::Mutex> g(mySocket->patcherLock);
+ ACE_Guard<ACE_Thread_Mutex> g(mySocket->patcherLock);
+
XFER_DATA_STRUCT xfdata;
xfdata.opcode = XFER_DATA;
@@ -974,7 +976,7 @@ void PatcherRunnable::run()
///- Wait until output buffer is reasonably empty
while(mySocket->Ready() && mySocket->IsLag())
{
- ZThread::Thread::sleep(1);
+ ACE_Based::Thread::Sleep(1);
}
///- And send content of the patch file to the client
xfdata.data_size=fread(&xfdata.data,1,ChunkSize,mySocket->pPatch);
@@ -1092,4 +1094,3 @@ Patcher::~Patcher()
for(Patches::iterator i = _patches.begin(); i != _patches.end(); i++ )
delete i->second;
}
-