Use server manager to allow SCTP and TCP at the same time.

This commit is contained in:
lotodore
2007-11-16 22:34:38 +00:00
parent 3d4bc78e64
commit bc16e26616
10 changed files with 296 additions and 124 deletions
+7 -19
View File
@@ -27,6 +27,8 @@
#include <gui/guiinterface.h>
#include <string>
#define NET_ACCEPT_THREAD_TERMINATE_TIMEOUT_MSEC 2000
class ServerContext;
class ServerLobbyThread;
class ServerSenderCallback;
@@ -36,27 +38,16 @@ class AvatarManager;
class IrcThread;
struct GameData;
class ServerAcceptThread : public Thread, public IrcCallback
class ServerAcceptThread : public Thread
{
public:
ServerAcceptThread(GuiInterface &gui, ConfigFile *config, AvatarManager &avatarManager);
ServerAcceptThread(ServerCallback &serverCallback);
virtual ~ServerAcceptThread();
// Set the parameters.
void Init(unsigned serverPort, bool ipv6, bool sctp, const std::string &pwd, const std::string &logDir, boost::shared_ptr<IrcThread> ircThread);
void Init(unsigned serverPort, bool ipv6, bool sctp, const std::string &pwd, const std::string &logDir, boost::shared_ptr<ServerLobbyThread> lobbyThread);
ServerCallback &GetCallback();
GuiInterface &GetGui();
virtual void SignalIrcConnect(const std::string &server);
virtual void SignalIrcSelfJoined(const std::string &nickName, const std::string &channel);
virtual void SignalIrcPlayerJoined(const std::string & /*nickName*/) {}
virtual void SignalIrcPlayerChanged(const std::string & /*oldNick*/, const std::string & /*newNick*/) {}
virtual void SignalIrcPlayerKicked(const std::string & /*nickName*/, const std::string & /*byWhom*/, const std::string & /*reason*/) {}
virtual void SignalIrcPlayerLeft(const std::string & /*nickName*/) {}
virtual void SignalIrcChatMsg(const std::string &nickName, const std::string &msg);
virtual void SignalIrcError(int errorCode);
virtual void SignalIrcServerError(int errorCode);
protected:
@@ -72,13 +63,10 @@ protected:
ServerLobbyThread &GetLobbyThread();
private:
ServerCallback &m_serverCallback;
boost::shared_ptr<ServerContext> m_context;
boost::shared_ptr<ServerLobbyThread> m_lobbyThread;
GuiInterface &m_gui;
std::string m_ircNick;
boost::shared_ptr<IrcThread> m_ircThread;
};
#endif