run astyle
This commit is contained in:
@@ -47,16 +47,19 @@ public:
|
||||
AsioSendBuffer();
|
||||
virtual ~AsioSendBuffer();
|
||||
|
||||
inline size_t GetSendBufLeft() const {
|
||||
inline size_t GetSendBufLeft() const
|
||||
{
|
||||
int bytesLeft = (int)(sendBufAllocated - sendBufUsed);
|
||||
return bytesLeft < 0 ? (size_t)0 : (size_t)bytesLeft;
|
||||
}
|
||||
|
||||
inline size_t GetAllocated() const {
|
||||
inline size_t GetAllocated() const
|
||||
{
|
||||
return sendBufAllocated;
|
||||
}
|
||||
|
||||
inline bool ReallocSendBuf() {
|
||||
inline bool ReallocSendBuf()
|
||||
{
|
||||
bool retVal = false;
|
||||
size_t allocAmount = sendBufAllocated * 2;
|
||||
if (0 == allocAmount) {
|
||||
@@ -73,7 +76,8 @@ public:
|
||||
return retVal;
|
||||
}
|
||||
|
||||
inline void AppendToSendBufWithoutCheck(const char *data, size_t size) {
|
||||
inline void AppendToSendBufWithoutCheck(const char *data, size_t size)
|
||||
{
|
||||
std::memcpy(sendBuf + sendBufUsed, data, size);
|
||||
sendBufUsed += size;
|
||||
}
|
||||
|
||||
+60
-30
@@ -49,96 +49,126 @@ public:
|
||||
void SetSessionData(boost::shared_ptr<SessionData> sessionData);
|
||||
boost::shared_ptr<boost::asio::ip::tcp::resolver> GetResolver() const;
|
||||
void SetResolver(boost::shared_ptr<boost::asio::ip::tcp::resolver> resolver);
|
||||
bool GetSctp() const {
|
||||
bool GetSctp() const
|
||||
{
|
||||
return m_sctp;
|
||||
}
|
||||
void SetSctp(bool sctp) {
|
||||
void SetSctp(bool sctp)
|
||||
{
|
||||
m_sctp = sctp;
|
||||
}
|
||||
int GetAddrFamily() const {
|
||||
int GetAddrFamily() const
|
||||
{
|
||||
return m_addrFamily;
|
||||
}
|
||||
void SetAddrFamily(int addrFamily) {
|
||||
void SetAddrFamily(int addrFamily)
|
||||
{
|
||||
m_addrFamily = addrFamily;
|
||||
}
|
||||
const std::string &GetServerAddr() const {
|
||||
const std::string &GetServerAddr() const
|
||||
{
|
||||
return m_serverAddr;
|
||||
}
|
||||
void SetServerAddr(const std::string &serverAddr) {
|
||||
void SetServerAddr(const std::string &serverAddr)
|
||||
{
|
||||
m_serverAddr = serverAddr;
|
||||
}
|
||||
const std::string &GetServerPassword() const {
|
||||
const std::string &GetServerPassword() const
|
||||
{
|
||||
return m_serverPassword;
|
||||
}
|
||||
void SetServerPassword(const std::string &serverPassword) {
|
||||
void SetServerPassword(const std::string &serverPassword)
|
||||
{
|
||||
m_serverPassword = serverPassword;
|
||||
}
|
||||
const std::string &GetServerListUrl() const {
|
||||
const std::string &GetServerListUrl() const
|
||||
{
|
||||
return m_serverListUrl;
|
||||
}
|
||||
void SetServerListUrl(const std::string &serverListUrl) {
|
||||
void SetServerListUrl(const std::string &serverListUrl)
|
||||
{
|
||||
m_serverListUrl = serverListUrl;
|
||||
}
|
||||
bool GetUseServerList() const {
|
||||
bool GetUseServerList() const
|
||||
{
|
||||
return m_useServerList;
|
||||
}
|
||||
void SetUseServerList(bool use) {
|
||||
void SetUseServerList(bool use)
|
||||
{
|
||||
m_useServerList = use;
|
||||
}
|
||||
unsigned GetServerPort() const {
|
||||
unsigned GetServerPort() const
|
||||
{
|
||||
return m_serverPort;
|
||||
}
|
||||
void SetServerPort(unsigned serverPort) {
|
||||
void SetServerPort(unsigned serverPort)
|
||||
{
|
||||
m_serverPort = serverPort;
|
||||
}
|
||||
const std::string &GetAvatarServerAddr() const {
|
||||
const std::string &GetAvatarServerAddr() const
|
||||
{
|
||||
return m_avatarServerAddr;
|
||||
}
|
||||
void SetAvatarServerAddr(const std::string &avatarServerAddr) {
|
||||
void SetAvatarServerAddr(const std::string &avatarServerAddr)
|
||||
{
|
||||
m_avatarServerAddr = avatarServerAddr;
|
||||
}
|
||||
const std::string &GetPassword() const {
|
||||
const std::string &GetPassword() const
|
||||
{
|
||||
return m_password;
|
||||
}
|
||||
void SetPassword(const std::string &password) {
|
||||
void SetPassword(const std::string &password)
|
||||
{
|
||||
m_password = password;
|
||||
}
|
||||
const std::string &GetPlayerName() const {
|
||||
const std::string &GetPlayerName() const
|
||||
{
|
||||
return m_playerName;
|
||||
}
|
||||
void SetPlayerName(const std::string &playerName) {
|
||||
void SetPlayerName(const std::string &playerName)
|
||||
{
|
||||
m_playerName = playerName;
|
||||
}
|
||||
PlayerRights GetPlayerRights() const {
|
||||
PlayerRights GetPlayerRights() const
|
||||
{
|
||||
return m_playerRights;
|
||||
}
|
||||
void SetPlayerRights(PlayerRights rights) {
|
||||
void SetPlayerRights(PlayerRights rights)
|
||||
{
|
||||
m_playerRights = rights;
|
||||
}
|
||||
const std::string &GetAvatarFile() const {
|
||||
const std::string &GetAvatarFile() const
|
||||
{
|
||||
return m_avatarFile;
|
||||
}
|
||||
void SetAvatarFile(const std::string &avatarFile) {
|
||||
void SetAvatarFile(const std::string &avatarFile)
|
||||
{
|
||||
m_avatarFile = avatarFile;
|
||||
}
|
||||
const std::string &GetCacheDir() const {
|
||||
const std::string &GetCacheDir() const
|
||||
{
|
||||
return m_cacheDir;
|
||||
}
|
||||
void SetCacheDir(const std::string &cacheDir) {
|
||||
void SetCacheDir(const std::string &cacheDir)
|
||||
{
|
||||
m_cacheDir = cacheDir;
|
||||
}
|
||||
bool GetSubscribeLobbyMsg() const {
|
||||
bool GetSubscribeLobbyMsg() const
|
||||
{
|
||||
return m_hasSubscribedLobbyMsg;
|
||||
}
|
||||
void SetSubscribeLobbyMsg(bool setSubscribe) {
|
||||
void SetSubscribeLobbyMsg(bool setSubscribe)
|
||||
{
|
||||
m_hasSubscribedLobbyMsg = setSubscribe;
|
||||
}
|
||||
|
||||
const std::string &GetSessionGuid() const {
|
||||
const std::string &GetSessionGuid() const
|
||||
{
|
||||
return m_sessionGuid;
|
||||
}
|
||||
|
||||
void SetSessionGuid(const std::string &sessionGuid) {
|
||||
void SetSessionGuid(const std::string &sessionGuid)
|
||||
{
|
||||
m_sessionGuid = sessionGuid;
|
||||
}
|
||||
|
||||
|
||||
+10
-5
@@ -66,19 +66,24 @@ class PingData
|
||||
public:
|
||||
PingData() : pingTimer(boost::posix_time::time_duration(0, 0, 0), boost::timers::portable::microsec_timer::manual_start) {}
|
||||
|
||||
unsigned MinPing() {
|
||||
unsigned MinPing()
|
||||
{
|
||||
return *std::min_element(pingValues.begin(), pingValues.end());
|
||||
}
|
||||
unsigned MaxPing() {
|
||||
unsigned MaxPing()
|
||||
{
|
||||
return *std::max_element(pingValues.begin(), pingValues.end());
|
||||
}
|
||||
unsigned AveragePing() {
|
||||
unsigned AveragePing()
|
||||
{
|
||||
return pingValues.empty() ? 0 : (std::accumulate(pingValues.begin(), pingValues.end(), 0) / (unsigned)pingValues.size());
|
||||
}
|
||||
void StartPing() {
|
||||
void StartPing()
|
||||
{
|
||||
pingTimer.start();
|
||||
}
|
||||
bool EndPing() {
|
||||
bool EndPing()
|
||||
{
|
||||
bool retVal = false;
|
||||
if (pingTimer.is_running()) {
|
||||
pingValues.push_back((unsigned)pingTimer.elapsed().total_milliseconds());
|
||||
|
||||
@@ -535,8 +535,7 @@ ClientStateStartConnect::TimerTimeout(const boost::system::error_code& ec, boost
|
||||
client->GetContext().GetSessionData()->GetAsioSocket()->close(ec);
|
||||
if (client->GetContext().GetAddrFamily() == AF_INET6) {
|
||||
throw ClientException(__FILE__, __LINE__, ERR_SOCK_CONNECT_IPV6_TIMEOUT, 0);
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
throw ClientException(__FILE__, __LINE__, ERR_SOCK_CONNECT_TIMEOUT, 0);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1175,8 +1175,7 @@ void
|
||||
ServerGame::AddPlayerToNumJoinsPerPlayer(const std::string &playerName)
|
||||
{
|
||||
NumJoinsPerPlayerMap::iterator pos = m_numJoinsPerPlayer.find(playerName);
|
||||
if (pos != m_numJoinsPerPlayer.end())
|
||||
{
|
||||
if (pos != m_numJoinsPerPlayer.end()) {
|
||||
pos->second++;
|
||||
} else {
|
||||
m_numJoinsPerPlayer[playerName] = 1;
|
||||
|
||||
@@ -107,35 +107,43 @@ public:
|
||||
InternalServerCallback(ServerLobbyThread &server) : m_server(server) {}
|
||||
virtual ~InternalServerCallback() {}
|
||||
|
||||
virtual void CloseSession(boost::shared_ptr<SessionData> session) {
|
||||
virtual void CloseSession(boost::shared_ptr<SessionData> session)
|
||||
{
|
||||
m_server.CloseSession(session);
|
||||
}
|
||||
|
||||
virtual void SessionError(boost::shared_ptr<SessionData> session, int errorCode) {
|
||||
virtual void SessionError(boost::shared_ptr<SessionData> session, int errorCode)
|
||||
{
|
||||
m_server.SessionError(session, errorCode);
|
||||
}
|
||||
|
||||
virtual void SessionTimeoutWarning(boost::shared_ptr<SessionData> session, unsigned remainingSec) {
|
||||
virtual void SessionTimeoutWarning(boost::shared_ptr<SessionData> session, unsigned remainingSec)
|
||||
{
|
||||
m_server.SessionTimeoutWarning(session, remainingSec);
|
||||
}
|
||||
|
||||
virtual void HandlePacket(boost::shared_ptr<SessionData> session, boost::shared_ptr<NetPacket> packet) {
|
||||
virtual void HandlePacket(boost::shared_ptr<SessionData> session, boost::shared_ptr<NetPacket> packet)
|
||||
{
|
||||
m_server.DispatchPacket(session, packet);
|
||||
}
|
||||
|
||||
virtual void SignalChatBotMessage(const string &msg) {
|
||||
virtual void SignalChatBotMessage(const string &msg)
|
||||
{
|
||||
m_server.SendChatBotMsg(msg);
|
||||
}
|
||||
|
||||
virtual void SignalChatBotMessage(unsigned gameId, const std::string &msg) {
|
||||
virtual void SignalChatBotMessage(unsigned gameId, const std::string &msg)
|
||||
{
|
||||
m_server.SendChatBotMsg(gameId, msg);
|
||||
}
|
||||
|
||||
virtual void SignalKickPlayer(unsigned playerId) {
|
||||
virtual void SignalKickPlayer(unsigned playerId)
|
||||
{
|
||||
m_server.RemovePlayer(playerId, ERR_NET_PLAYER_KICKED);
|
||||
}
|
||||
|
||||
virtual void SignalBanPlayer(unsigned playerId) {
|
||||
virtual void SignalBanPlayer(unsigned playerId)
|
||||
{
|
||||
string playerName(m_server.GetPlayerNameFromId(playerId));
|
||||
if (!playerName.empty()) {
|
||||
m_server.GetBanManager().BanPlayerName(playerName, 1);
|
||||
@@ -143,76 +151,94 @@ public:
|
||||
}
|
||||
}
|
||||
|
||||
virtual void SignalMutePlayer(unsigned playerId) {
|
||||
virtual void SignalMutePlayer(unsigned playerId)
|
||||
{
|
||||
m_server.MutePlayerInGame(playerId);
|
||||
}
|
||||
|
||||
virtual void ConnectSuccess() {
|
||||
virtual void ConnectSuccess()
|
||||
{
|
||||
LOG_MSG("Successfully connected to database.");
|
||||
}
|
||||
|
||||
virtual void ConnectFailed(string error) {
|
||||
virtual void ConnectFailed(string error)
|
||||
{
|
||||
LOG_ERROR("DB connect error: " << error);
|
||||
}
|
||||
|
||||
virtual void QueryError(string error) {
|
||||
virtual void QueryError(string error)
|
||||
{
|
||||
LOG_ERROR("DB query error: " << error);
|
||||
}
|
||||
|
||||
virtual void PlayerLoginSuccess(unsigned requestId, boost::shared_ptr<DBPlayerData> dbPlayerData) {
|
||||
virtual void PlayerLoginSuccess(unsigned requestId, boost::shared_ptr<DBPlayerData> dbPlayerData)
|
||||
{
|
||||
m_server.UserValid(requestId, *dbPlayerData);
|
||||
}
|
||||
|
||||
virtual void PlayerLoginFailed(unsigned requestId) {
|
||||
virtual void PlayerLoginFailed(unsigned requestId)
|
||||
{
|
||||
m_server.UserInvalid(requestId);
|
||||
}
|
||||
|
||||
virtual void PlayerLoginBlocked(unsigned requestId) {
|
||||
virtual void PlayerLoginBlocked(unsigned requestId)
|
||||
{
|
||||
m_server.UserBlocked(requestId);
|
||||
}
|
||||
|
||||
virtual void AvatarIsBlacklisted(unsigned requestId) {
|
||||
virtual void AvatarIsBlacklisted(unsigned requestId)
|
||||
{
|
||||
m_server.AvatarBlacklisted(requestId);
|
||||
}
|
||||
|
||||
virtual void AvatarIsOK(unsigned requestId) {
|
||||
virtual void AvatarIsOK(unsigned requestId)
|
||||
{
|
||||
m_server.AvatarOK(requestId);
|
||||
}
|
||||
|
||||
virtual void CreateGameSuccess(unsigned /*requestId*/) {
|
||||
virtual void CreateGameSuccess(unsigned /*requestId*/)
|
||||
{
|
||||
// Nothing to do.
|
||||
}
|
||||
|
||||
virtual void CreateGameFailed(unsigned requestId) {
|
||||
virtual void CreateGameFailed(unsigned requestId)
|
||||
{
|
||||
// TODO maybe handle request id.
|
||||
LOG_ERROR("DB create game failed for request " << requestId);
|
||||
}
|
||||
|
||||
virtual void ReportAvatarSuccess(unsigned requestId, unsigned replyId) {
|
||||
virtual void ReportAvatarSuccess(unsigned requestId, unsigned replyId)
|
||||
{
|
||||
m_server.SendReportAvatarResult(requestId, replyId, true);
|
||||
}
|
||||
|
||||
virtual void ReportAvatarFailed(unsigned requestId, unsigned replyId) {
|
||||
virtual void ReportAvatarFailed(unsigned requestId, unsigned replyId)
|
||||
{
|
||||
m_server.SendReportAvatarResult(requestId, replyId, false);
|
||||
}
|
||||
|
||||
virtual void ReportGameSuccess(unsigned requestId, unsigned replyId) {
|
||||
virtual void ReportGameSuccess(unsigned requestId, unsigned replyId)
|
||||
{
|
||||
m_server.SendReportGameResult(requestId, replyId, true);
|
||||
}
|
||||
|
||||
virtual void ReportGameFailed(unsigned requestId, unsigned replyId) {
|
||||
virtual void ReportGameFailed(unsigned requestId, unsigned replyId)
|
||||
{
|
||||
m_server.SendReportGameResult(requestId, replyId, false);
|
||||
}
|
||||
|
||||
virtual void PlayerAdminList(unsigned /*requestId*/, std::list<DB_id> adminList) {
|
||||
virtual void PlayerAdminList(unsigned /*requestId*/, std::list<DB_id> adminList)
|
||||
{
|
||||
m_server.GetBanManager().SetAdminPlayerIds(adminList);
|
||||
}
|
||||
|
||||
virtual void BlockPlayerSuccess(unsigned requestId, unsigned replyId) {
|
||||
virtual void BlockPlayerSuccess(unsigned requestId, unsigned replyId)
|
||||
{
|
||||
m_server.SendAdminBanPlayerResult(requestId, replyId, true);
|
||||
}
|
||||
|
||||
virtual void BlockPlayerFailed(unsigned requestId, unsigned replyId) {
|
||||
virtual void BlockPlayerFailed(unsigned requestId, unsigned replyId)
|
||||
{
|
||||
m_server.SendAdminBanPlayerResult(requestId, replyId, false);
|
||||
}
|
||||
|
||||
@@ -975,9 +1001,8 @@ ServerLobbyThread::HandlePacket(boost::shared_ptr<SessionData> session, boost::s
|
||||
HandleNetPacketRetrievePlayerInfo(session, packet->GetMsg()->playerinforequestmessage());
|
||||
else if (packet->GetMsg()->messagetype() == PokerTHMessage::Type_AvatarRequestMessage)
|
||||
HandleNetPacketRetrieveAvatar(session, packet->GetMsg()->avatarrequestmessage());
|
||||
else if (packet->GetMsg()->messagetype() == PokerTHMessage::Type_ResetTimeoutMessage)
|
||||
{}
|
||||
else if (packet->GetMsg()->messagetype() == PokerTHMessage::Type_SubscriptionRequestMessage) {
|
||||
else if (packet->GetMsg()->messagetype() == PokerTHMessage::Type_ResetTimeoutMessage) {
|
||||
} else if (packet->GetMsg()->messagetype() == PokerTHMessage::Type_SubscriptionRequestMessage) {
|
||||
const SubscriptionRequestMessage &subscriptionRequest = packet->GetMsg()->subscriptionrequestmessage();
|
||||
if (subscriptionRequest.subscriptionaction() == SubscriptionRequestMessage::resubscribeGameList)
|
||||
InternalResubscribeMsg(session);
|
||||
@@ -1068,7 +1093,7 @@ ServerLobbyThread::HandleNetPacketInit(boost::shared_ptr<SessionData> session, c
|
||||
// check if a guest session in lobby with same ip is already connected and
|
||||
// if number of lobby guests >= SERVER_MAX_GUEST_USERS_LOBBY
|
||||
if(m_serverConfig.readConfigInt("ServerRestrictGuestLogin") != 0
|
||||
&& !m_sessionManager.IsGuestAllowedToConnect(session->GetClientAddr())) {
|
||||
&& !m_sessionManager.IsGuestAllowedToConnect(session->GetClientAddr())) {
|
||||
SessionError(session, ERR_NET_SERVER_FULL);
|
||||
return;
|
||||
}
|
||||
@@ -1706,8 +1731,7 @@ ServerLobbyThread::EstablishSession(boost::shared_ptr<SessionData> session)
|
||||
if (session->GetWebData()) {
|
||||
SessionError(session, ERR_NET_PLAYER_NAME_IN_USE);
|
||||
return;
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
// If this is not a websocket connection, disconnect the already connected player.
|
||||
InternalRemovePlayer(previousPlayerId, ERR_NET_PLAYER_NAME_IN_USE);
|
||||
}
|
||||
|
||||
@@ -321,7 +321,7 @@ SessionData::CloseWebSocketHandle()
|
||||
#if defined(__GXX_EXPERIMENTAL_CXX0X__) || (__cplusplus >= 201103L) // c++11
|
||||
std::error_code std_ec;
|
||||
m_webData->webSocketServer->close(m_webData->webHandle, websocketpp::close::status::normal, "PokerTH server closed the connection.", std_ec);
|
||||
#else
|
||||
#else
|
||||
boost::system::error_code ec;
|
||||
m_webData->webSocketServer->close(m_webData->webHandle, websocketpp::close::status::normal, "PokerTH server closed the connection.", ec);
|
||||
#endif
|
||||
|
||||
@@ -61,7 +61,7 @@ WebSendBuffer::AsyncSendNextPacket(boost::shared_ptr<SessionData> session)
|
||||
#if defined(__GXX_EXPERIMENTAL_CXX0X__) || (__cplusplus >= 201103L)
|
||||
std::error_code std_ec;
|
||||
webData->webSocketServer->close(webData->webHandle, websocketpp::close::status::normal, "PokerTH server closed the connection.", std_ec);
|
||||
#else
|
||||
#else
|
||||
boost::system::error_code ec;
|
||||
webData->webSocketServer->close(webData->webHandle, websocketpp::close::status::normal, "PokerTH server closed the connection.", ec);
|
||||
#endif
|
||||
@@ -80,7 +80,7 @@ WebSendBuffer::InternalStorePacket(boost::shared_ptr<SessionData> session, boost
|
||||
std::error_code std_ec;
|
||||
webData->webSocketServer->send(webData->webHandle, string((const char *)buf, packetSize), websocketpp::frame::opcode::BINARY, std_ec);
|
||||
if (std_ec) {
|
||||
#else
|
||||
#else
|
||||
boost::system::error_code ec;
|
||||
webData->webSocketServer->send(webData->webHandle, string((const char *)buf, packetSize), websocketpp::frame::opcode::BINARY, ec);
|
||||
if (ec) {
|
||||
|
||||
+4
-2
@@ -65,10 +65,12 @@ public:
|
||||
|
||||
static boost::shared_ptr<NetPacket> Create(const char *data, size_t dataSize);
|
||||
|
||||
const PokerTHMessage *GetMsg() const {
|
||||
const PokerTHMessage *GetMsg() const
|
||||
{
|
||||
return m_msg;
|
||||
}
|
||||
PokerTHMessage *GetMsg() {
|
||||
PokerTHMessage *GetMsg()
|
||||
{
|
||||
return m_msg;
|
||||
}
|
||||
|
||||
|
||||
@@ -52,16 +52,19 @@ public:
|
||||
typedef typename P::endpoint P_endpoint;
|
||||
|
||||
ServerAcceptHelper(ServerCallback &serverCallback, boost::shared_ptr<boost::asio::io_service> ioService)
|
||||
: m_ioService(ioService), m_serverCallback(serverCallback) {
|
||||
: m_ioService(ioService), m_serverCallback(serverCallback)
|
||||
{
|
||||
m_acceptor.reset(new P_acceptor(*m_ioService));
|
||||
}
|
||||
|
||||
virtual ~ServerAcceptHelper() {
|
||||
virtual ~ServerAcceptHelper()
|
||||
{
|
||||
}
|
||||
|
||||
// Set the parameters.
|
||||
virtual void Listen(unsigned serverPort, bool ipv6, const std::string &/*logDir*/,
|
||||
boost::shared_ptr<ServerLobbyThread> lobbyThread) {
|
||||
boost::shared_ptr<ServerLobbyThread> lobbyThread)
|
||||
{
|
||||
m_lobbyThread = lobbyThread;
|
||||
|
||||
try {
|
||||
@@ -77,14 +80,16 @@ public:
|
||||
}
|
||||
}
|
||||
|
||||
virtual void Close() {
|
||||
virtual void Close()
|
||||
{
|
||||
boost::system::error_code ec;
|
||||
m_acceptor->close(ec);
|
||||
// Ignore any error, because we are terminating.
|
||||
}
|
||||
protected:
|
||||
|
||||
void InternalListen(unsigned serverPort, bool ipv6) {
|
||||
void InternalListen(unsigned serverPort, bool ipv6)
|
||||
{
|
||||
if (serverPort < 1024)
|
||||
throw ServerException(__FILE__, __LINE__, ERR_SOCK_INVALID_PORT, 0);
|
||||
|
||||
@@ -114,7 +119,8 @@ protected:
|
||||
}
|
||||
|
||||
void HandleAccept(boost::shared_ptr<typename P::socket> acceptedSocket,
|
||||
const boost::system::error_code &error) {
|
||||
const boost::system::error_code &error)
|
||||
{
|
||||
if (!error) {
|
||||
boost::asio::socket_base::non_blocking_io command(true);
|
||||
acceptedSocket->io_control(command);
|
||||
@@ -136,11 +142,13 @@ protected:
|
||||
}
|
||||
}
|
||||
|
||||
ServerCallback &GetCallback() {
|
||||
ServerCallback &GetCallback()
|
||||
{
|
||||
return m_serverCallback;
|
||||
}
|
||||
|
||||
ServerLobbyThread &GetLobbyThread() {
|
||||
ServerLobbyThread &GetLobbyThread()
|
||||
{
|
||||
return *m_lobbyThread;
|
||||
}
|
||||
|
||||
|
||||
@@ -67,10 +67,12 @@ protected:
|
||||
typedef std::list<boost::shared_ptr<ServerAcceptInterface> > AcceptHelperList;
|
||||
|
||||
ServerLobbyThread &GetLobbyThread();
|
||||
ConfigFile &GetConfig() {
|
||||
ConfigFile &GetConfig()
|
||||
{
|
||||
return m_playerConfig;
|
||||
}
|
||||
GuiInterface &GetGui() {
|
||||
GuiInterface &GetGui()
|
||||
{
|
||||
return m_gui;
|
||||
}
|
||||
boost::shared_ptr<boost::asio::io_service> m_ioService;
|
||||
|
||||
@@ -96,19 +96,23 @@ public:
|
||||
const std::string &GetClientAddr() const;
|
||||
void SetClientAddr(const std::string &addr);
|
||||
|
||||
ReceiveBuffer &GetReceiveBuffer() {
|
||||
ReceiveBuffer &GetReceiveBuffer()
|
||||
{
|
||||
return *m_receiveBuffer;
|
||||
}
|
||||
SendBuffer &GetSendBuffer() {
|
||||
SendBuffer &GetSendBuffer()
|
||||
{
|
||||
return *m_sendBuffer;
|
||||
}
|
||||
|
||||
void Close() {
|
||||
void Close()
|
||||
{
|
||||
m_callback.CloseSession(shared_from_this());
|
||||
}
|
||||
void CloseSocketHandle();
|
||||
void CloseWebSocketHandle();
|
||||
void HandlePacket(boost::shared_ptr<NetPacket> packet) {
|
||||
void HandlePacket(boost::shared_ptr<NetPacket> packet)
|
||||
{
|
||||
m_callback.HandlePacket(shared_from_this(), packet);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user