Adopting changes from asio branch. Currently broken.
This commit is contained in:
@@ -21,51 +21,39 @@
|
||||
#ifndef _SERVERACCEPTTHREAD_H_
|
||||
#define _SERVERACCEPTTHREAD_H_
|
||||
|
||||
#include <boost/asio.hpp>
|
||||
#include <game_defs.h>
|
||||
#include <core/thread.h>
|
||||
|
||||
#include <gui/guiinterface.h>
|
||||
#include <string>
|
||||
|
||||
#define NET_ACCEPT_THREAD_TERMINATE_TIMEOUT_MSEC 2000
|
||||
|
||||
class ServerContext;
|
||||
class ServerLobbyThread;
|
||||
class ServerSenderCallback;
|
||||
class SenderThread;
|
||||
class ConfigFile;
|
||||
class AvatarManager;
|
||||
class IrcThread;
|
||||
struct GameData;
|
||||
|
||||
class ServerAcceptThread : public Thread
|
||||
class ServerAcceptThread
|
||||
{
|
||||
public:
|
||||
ServerAcceptThread(ServerCallback &serverCallback);
|
||||
ServerAcceptThread(ServerCallback &serverCallback, boost::shared_ptr<boost::asio::io_service> ioService);
|
||||
virtual ~ServerAcceptThread();
|
||||
|
||||
// Set the parameters.
|
||||
void Init(unsigned serverPort, bool ipv6, bool sctp, const std::string &pwd, const std::string &logDir, boost::shared_ptr<ServerLobbyThread> lobbyThread);
|
||||
|
||||
ServerCallback &GetCallback();
|
||||
void Listen(unsigned serverPort, bool ipv6, bool sctp, const std::string &pwd, const std::string &logDir,
|
||||
boost::shared_ptr<ServerLobbyThread> lobbyThread);
|
||||
|
||||
protected:
|
||||
|
||||
// Main function of the thread.
|
||||
virtual void Main();
|
||||
void InternalListen(unsigned serverPort, bool ipv6, bool sctp);
|
||||
void HandleAccept(boost::shared_ptr<boost::asio::ip::tcp::socket> acceptedSocket,
|
||||
const boost::system::error_code& error);
|
||||
|
||||
void Listen();
|
||||
void AcceptLoop();
|
||||
|
||||
const ServerContext &GetContext() const;
|
||||
ServerContext &GetContext();
|
||||
ServerCallback &GetCallback();
|
||||
|
||||
ServerLobbyThread &GetLobbyThread();
|
||||
|
||||
private:
|
||||
boost::shared_ptr<boost::asio::io_service> m_ioService;
|
||||
boost::shared_ptr<boost::asio::ip::tcp::acceptor> m_acceptor;
|
||||
boost::shared_ptr<boost::asio::ip::tcp::endpoint> m_endpoint;
|
||||
ServerCallback &m_serverCallback;
|
||||
|
||||
boost::shared_ptr<ServerContext> m_context;
|
||||
boost::shared_ptr<ServerLobbyThread> m_lobbyThread;
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user