From 913f9db110be5176f96a94b211de841b7b30a18a Mon Sep 17 00:00:00 2001 From: lotodore Date: Wed, 15 Aug 2007 13:36:29 +0000 Subject: [PATCH] Preparing to rename some of the network engine files. --- src/net/common/serverthread.cpp | 40 ++++++++++++++++----------------- src/net/serverrecvthread.h | 2 +- src/net/serverthread.h | 18 +++++++-------- 3 files changed, 30 insertions(+), 30 deletions(-) diff --git a/src/net/common/serverthread.cpp b/src/net/common/serverthread.cpp index 014563d0..4eef1316 100644 --- a/src/net/common/serverthread.cpp +++ b/src/net/common/serverthread.cpp @@ -30,19 +30,19 @@ using namespace std; -ServerThread::ServerThread(GuiInterface &gui, ConfigFile *config) +ServerAcceptThread::ServerAcceptThread(GuiInterface &gui, ConfigFile *config) : m_gui(gui) { m_context.reset(new ServerContext); - m_recvThread.reset(new ServerRecvThread(gui, config)); + m_lobbyThread.reset(new ServerLobbyThread(gui, config)); } -ServerThread::~ServerThread() +ServerAcceptThread::~ServerAcceptThread() { } void -ServerThread::Init(unsigned serverPort, bool ipv6, bool sctp, const std::string &pwd, +ServerAcceptThread::Init(unsigned serverPort, bool ipv6, bool sctp, const std::string &pwd, const GameData &gameData) { if (IsRunning()) @@ -54,28 +54,28 @@ ServerThread::Init(unsigned serverPort, bool ipv6, bool sctp, const std::string context.SetAddrFamily(ipv6 ? AF_INET6 : AF_INET); context.SetServerPort(serverPort); - GetRecvThread().Init(pwd, gameData); + GetLobbyThread().Init(pwd); } ServerCallback & -ServerThread::GetCallback() +ServerAcceptThread::GetCallback() { return m_gui; } GuiInterface & -ServerThread::GetGui() +ServerAcceptThread::GetGui() { return m_gui; } void -ServerThread::Main() +ServerAcceptThread::Main() { try { Listen(); - GetRecvThread().Run(); + GetLobbyThread().Run(); while (!ShouldTerminate()) { @@ -86,12 +86,12 @@ ServerThread::Main() { GetCallback().SignalNetServerError(e.GetErrorId(), e.GetOsErrorCode()); } - GetRecvThread().SignalTermination(); - GetRecvThread().Join(RECEIVER_THREAD_TERMINATE_TIMEOUT); + GetLobbyThread().SignalTermination(); + GetLobbyThread().Join(LOBBY_THREAD_TERMINATE_TIMEOUT); } void -ServerThread::Listen() +ServerAcceptThread::Listen() { ServerContext &context = GetContext(); @@ -147,7 +147,7 @@ ServerThread::Listen() } void -ServerThread::AcceptLoop() +ServerAcceptThread::AcceptLoop() { ServerContext &context = GetContext(); @@ -174,28 +174,28 @@ ServerThread::AcceptLoop() throw ServerException(ERR_SOCK_ACCEPT_FAILED, SOCKET_ERRNO()); } - GetRecvThread().AddConnection(tmpData); + GetLobbyThread().AddConnection(tmpData); } } const ServerContext & -ServerThread::GetContext() const +ServerAcceptThread::GetContext() const { assert(m_context.get()); return *m_context; } ServerContext & -ServerThread::GetContext() +ServerAcceptThread::GetContext() { assert(m_context.get()); return *m_context; } -ServerRecvThread & -ServerThread::GetRecvThread() +ServerLobbyThread & +ServerAcceptThread::GetLobbyThread() { - assert(m_recvThread.get()); - return *m_recvThread; + assert(m_lobbyThread.get()); + return *m_lobbyThread; } diff --git a/src/net/serverrecvthread.h b/src/net/serverrecvthread.h index 9f15af17..8baf48c1 100644 --- a/src/net/serverrecvthread.h +++ b/src/net/serverrecvthread.h @@ -31,7 +31,7 @@ #include #include -#define RECEIVER_THREAD_TERMINATE_TIMEOUT 200 +#define LOBBY_THREAD_TERMINATE_TIMEOUT 200 class SenderThread; diff --git a/src/net/serverthread.h b/src/net/serverthread.h index c6f50c5e..df7681b6 100644 --- a/src/net/serverthread.h +++ b/src/net/serverthread.h @@ -16,10 +16,10 @@ * Free Software Foundation, Inc., * * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * ***************************************************************************/ -/* Network server thread. */ +/* Network server thread to accept connections. */ -#ifndef _SERVERTHREAD_H_ -#define _SERVERTHREAD_H_ +#ifndef _SERVERACCEPTTHREAD_H_ +#define _SERVERACCEPTTHREAD_H_ #include #include @@ -28,17 +28,17 @@ #include class ServerContext; -class ServerRecvThread; +class ServerLobbyThread; class ServerSenderCallback; class SenderThread; class ConfigFile; struct GameData; -class ServerThread : public Thread +class ServerAcceptThread : public Thread { public: - ServerThread(GuiInterface &gui, ConfigFile *config); - virtual ~ServerThread(); + ServerAcceptThread(GuiInterface &gui, ConfigFile *config); + virtual ~ServerAcceptThread(); // Set the parameters. void Init(unsigned serverPort, bool ipv6, bool sctp, const std::string &pwd, @@ -58,11 +58,11 @@ protected: const ServerContext &GetContext() const; ServerContext &GetContext(); - ServerRecvThread &GetRecvThread(); + ServerLobbyThread &GetLobbyThread(); private: std::auto_ptr m_context; - std::auto_ptr m_recvThread; + std::auto_ptr m_lobbyThread; GuiInterface &m_gui; };