More restructuring. Still broken.

This commit is contained in:
lotodore
2009-05-10 22:21:20 +00:00
parent 2541f28ff2
commit 8ab2fed1a2
13 changed files with 51 additions and 51 deletions
+1 -1
View File
@@ -20,7 +20,7 @@
#include <net/clientstate.h>
#include <net/clientthread.h>
#include <net/clientcontext.h>
#include <net/senderthread.h>
#include <net/senderhelper.h>
#include <net/receiverhelper.h>
#include <net/netpacket.h>
#include <net/resolverthread.h>
+3 -3
View File
@@ -22,7 +22,7 @@
#include <net/clientthread.h>
#include <net/clientstate.h>
#include <net/clientcontext.h>
#include <net/senderthread.h>
#include <net/senderhelper.h>
#include <net/receiverhelper.h>
#include <net/downloaderthread.h>
#include <net/clientexception.h>
@@ -70,7 +70,7 @@ ClientThread::ClientThread(GuiInterface &gui, AvatarManager &avatarManager)
m_receiver.reset(new ReceiverHelper);
myQtToolsInterface.reset(CreateQtToolsWrapper());
m_senderCallback.reset(new ClientSenderCallback());
m_senderThread.reset(new SenderThread(*m_senderCallback, m_ioService));
m_senderHelper.reset(new SenderHelper(*m_senderCallback, m_ioService));
}
ClientThread::~ClientThread()
@@ -737,7 +737,7 @@ ClientThread::CreateContextSession()
GetContext().SetSessionData(boost::shared_ptr<SessionData>(new SessionData(
newSock,
SESSION_ID_GENERIC,
m_senderThread,
m_senderHelper,
*m_senderCallback)));
validSocket = true;
} catch (...)
@@ -18,7 +18,7 @@
***************************************************************************/
#include <net/socket_helper.h>
#include <net/senderthread.h>
#include <net/senderhelper.h>
#include <net/sendercallback.h>
#include <net/socket_msg.h>
#include <core/loghelper.h>
@@ -91,17 +91,17 @@ SendDataManager::AsyncSendNextPacket(bool handlerMode)
}
}
SenderThread::SenderThread(SenderCallback &cb, boost::shared_ptr<boost::asio::io_service> ioService)
SenderHelper::SenderHelper(SenderCallback &cb, boost::shared_ptr<boost::asio::io_service> ioService)
: m_callback(cb), m_ioService(ioService)
{
}
SenderThread::~SenderThread()
SenderHelper::~SenderHelper()
{
}
void
SenderThread::Send(boost::shared_ptr<SessionData> session, boost::shared_ptr<NetPacket> packet)
SenderHelper::Send(boost::shared_ptr<SessionData> session, boost::shared_ptr<NetPacket> packet)
{
if (packet.get() && session.get())
{
@@ -129,7 +129,7 @@ SenderThread::Send(boost::shared_ptr<SessionData> session, boost::shared_ptr<Net
}
void
SenderThread::Send(boost::shared_ptr<SessionData> session, const NetPacketList &packetList)
SenderHelper::Send(boost::shared_ptr<SessionData> session, const NetPacketList &packetList)
{
if (!packetList.empty() && session.get())
{
@@ -165,14 +165,14 @@ SenderThread::Send(boost::shared_ptr<SessionData> session, const NetPacketList &
}
void
SenderThread::SignalSessionTerminated(unsigned sessionId)
SenderHelper::SignalSessionTerminated(unsigned sessionId)
{
boost::mutex::scoped_lock lock(m_removedSessionsMutex);
m_removedSessions.push_back(sessionId);
}
void
SenderThread::Process()
SenderHelper::Process()
{
// Close sessions if they were destructed.
{
@@ -17,7 +17,7 @@
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
***************************************************************************/
#include <net/serveracceptmanager.h>
#include <net/serveraccepthelper.h>
#include <net/serverlobbythread.h>
#include <net/serverexception.h>
#include <net/socket_msg.h>
@@ -29,18 +29,18 @@
using namespace std;
using boost::asio::ip::tcp;
ServerAcceptManager::ServerAcceptManager(ServerCallback &serverCallback, boost::shared_ptr<boost::asio::io_service> ioService)
ServerAcceptHelper::ServerAcceptHelper(ServerCallback &serverCallback, boost::shared_ptr<boost::asio::io_service> ioService)
: m_ioService(ioService), m_serverCallback(serverCallback)
{
m_acceptor.reset(new tcp::acceptor(*m_ioService));
}
ServerAcceptManager::~ServerAcceptManager()
ServerAcceptHelper::~ServerAcceptHelper()
{
}
void
ServerAcceptManager::Listen(unsigned serverPort, bool ipv6, bool sctp, const string &pwd, const string &logDir, boost::shared_ptr<ServerLobbyThread> lobbyThread)
ServerAcceptHelper::Listen(unsigned serverPort, bool ipv6, bool sctp, const string &pwd, const string &logDir, boost::shared_ptr<ServerLobbyThread> lobbyThread)
{
m_lobbyThread = lobbyThread;
@@ -63,7 +63,7 @@ ServerAcceptManager::Listen(unsigned serverPort, bool ipv6, bool sctp, const str
}
void
ServerAcceptManager::InternalListen(unsigned serverPort, bool ipv6, bool sctp)
ServerAcceptHelper::InternalListen(unsigned serverPort, bool ipv6, bool sctp)
{
if (serverPort < 1024)
throw ServerException(__FILE__, __LINE__, ERR_SOCK_INVALID_PORT, 0);
@@ -89,13 +89,13 @@ ServerAcceptManager::InternalListen(unsigned serverPort, bool ipv6, bool sctp)
boost::shared_ptr<tcp::socket> newSocket(new tcp::socket(*m_ioService));
m_acceptor->async_accept(
*newSocket,
boost::bind(&ServerAcceptManager::HandleAccept, this, newSocket,
boost::bind(&ServerAcceptHelper::HandleAccept, this, newSocket,
boost::asio::placeholders::error)
);
}
void
ServerAcceptManager::HandleAccept(boost::shared_ptr<boost::asio::ip::tcp::socket> acceptedSocket,
ServerAcceptHelper::HandleAccept(boost::shared_ptr<boost::asio::ip::tcp::socket> acceptedSocket,
const boost::system::error_code& error)
{
if (!error)
@@ -109,7 +109,7 @@ ServerAcceptManager::HandleAccept(boost::shared_ptr<boost::asio::ip::tcp::socket
boost::shared_ptr<tcp::socket> newSocket(new tcp::socket(*m_ioService));
m_acceptor->async_accept(
*newSocket,
boost::bind(&ServerAcceptManager::HandleAccept, this, newSocket,
boost::bind(&ServerAcceptHelper::HandleAccept, this, newSocket,
boost::asio::placeholders::error)
);
}
@@ -122,13 +122,13 @@ ServerAcceptManager::HandleAccept(boost::shared_ptr<boost::asio::ip::tcp::socket
}
ServerCallback &
ServerAcceptManager::GetCallback()
ServerAcceptHelper::GetCallback()
{
return m_serverCallback;
}
ServerLobbyThread &
ServerAcceptManager::GetLobbyThread()
ServerAcceptHelper::GetLobbyThread()
{
assert(m_lobbyThread.get());
return *m_lobbyThread;
+1 -1
View File
@@ -21,7 +21,7 @@
#include <net/servergamethread.h>
#include <net/serverlobbythread.h>
#include <net/receiverhelper.h>
#include <net/senderthread.h>
#include <net/senderhelper.h>
#include <net/netpacket.h>
#include <net/socket_msg.h>
#include <net/serverexception.h>
+1 -1
View File
@@ -21,7 +21,7 @@
#include <net/servergamestate.h>
#include <net/serverlobbythread.h>
#include <net/serverexception.h>
#include <net/senderthread.h>
#include <net/senderhelper.h>
#include <net/receiverhelper.h>
#include <net/socket_msg.h>
#include <core/loghelper.h>
+2 -2
View File
@@ -20,7 +20,7 @@
#include <net/serverlobbythread.h>
#include <net/servergamethread.h>
#include <net/serverexception.h>
#include <net/senderthread.h>
#include <net/senderhelper.h>
#include <net/sendercallback.h>
#include <net/receiverhelper.h>
#include <net/socket_msg.h>
@@ -93,7 +93,7 @@ ServerLobbyThread::ServerLobbyThread(GuiInterface &gui, ConfigFile *playerConfig
m_statDataChanged(false), m_startTime(boost::posix_time::second_clock::local_time())
{
m_senderCallback.reset(new ServerSenderCallback(*this));
m_sender.reset(new SenderThread(*m_senderCallback, m_ioService));
m_sender.reset(new SenderHelper(*m_senderCallback, m_ioService));
m_receiver.reset(new ReceiverHelper);
}
+7 -7
View File
@@ -23,7 +23,7 @@
#include <net/ircthread.h>
#include <net/connectdata.h>
#include <net/serverlobbythread.h>
#include <net/serveracceptmanager.h>
#include <net/serveraccepthelper.h>
#include <net/serverexception.h>
#include <net/socket_msg.h>
#include <net/socket_startup.h>
@@ -54,15 +54,15 @@ ServerManager::Init(unsigned serverPort, bool ipv6, ServerNetworkMode mode, cons
if (mode & NETWORK_MODE_TCP)
{
boost::shared_ptr<ServerAcceptManager> tcpAcceptThread(new ServerAcceptManager(GetGui(), m_ioService));
tcpAcceptThread->Listen(serverPort, ipv6, false, pwd, logDir, m_lobbyThread);
m_acceptManagerPool.push_back(tcpAcceptThread);
boost::shared_ptr<ServerAcceptHelper> tcpAcceptHelper(new ServerAcceptHelper(GetGui(), m_ioService));
tcpAcceptHelper->Listen(serverPort, ipv6, false, pwd, logDir, m_lobbyThread);
m_acceptHelperPool.push_back(tcpAcceptHelper);
}
if (mode & NETWORK_MODE_SCTP)
{
boost::shared_ptr<ServerAcceptManager> sctpAcceptThread(new ServerAcceptManager(GetGui(), m_ioService));
sctpAcceptThread->Listen(serverPort, ipv6, true, pwd, logDir, m_lobbyThread);
m_acceptManagerPool.push_back(sctpAcceptThread);
boost::shared_ptr<ServerAcceptHelper> sctpAcceptHelper(new ServerAcceptHelper(GetGui(), m_ioService));
sctpAcceptHelper->Listen(serverPort, ipv6, true, pwd, logDir, m_lobbyThread);
m_acceptHelperPool.push_back(sctpAcceptHelper);
}
m_ircThread = ircThread;
}