From 744e5c81d46147c42e83412b86e5564ca2c5abc0 Mon Sep 17 00:00:00 2001 From: lotodore Date: Sat, 13 Jun 2009 10:52:12 +0000 Subject: [PATCH] Small fixes. Removing some TODO comments which are no longer valid. --- src/game.cpp | 1 - src/net/common/netpacket.cpp | 2 -- src/net/common/senderhelper.cpp | 1 - src/net/common/serveraccepthelper.cpp | 8 +++----- src/net/common/servergamestate.cpp | 4 +--- src/session.cpp | 2 -- 6 files changed, 4 insertions(+), 14 deletions(-) diff --git a/src/game.cpp b/src/game.cpp index d61ec9ff..58381d6d 100755 --- a/src/game.cpp +++ b/src/game.cpp @@ -88,7 +88,6 @@ Game::Game(GuiInterface* gui, boost::shared_ptr factory, myName = (*player_i)->GetName(); myAvatarFile = (*player_i)->GetAvatarFile(); myNetSession = (*player_i)->GetNetSessionData(); - // TODO: set player type ++player_i; } diff --git a/src/net/common/netpacket.cpp b/src/net/common/netpacket.cpp index a5eaeda6..6328f641 100644 --- a/src/net/common/netpacket.cpp +++ b/src/net/common/netpacket.cpp @@ -3492,8 +3492,6 @@ NetPacketGameStart::SetData(const NetPacketGameStart::Data &inData) // Basic checking. if (numPlayers < MIN_NUMBER_OF_PLAYERS || numPlayers > MAX_NUMBER_OF_PLAYERS || numPlayers != inData.startData.numberOfPlayers) { - // This seems to occur too often. - // TODO needs fix. LOG_VERBOSE("Invalid number of players. Slots: " << numPlayers << ", Players: " << inData.startData.numberOfPlayers << "."); throw NetException(__FILE__, __LINE__, ERR_NET_INVALID_PLAYER_COUNT, 0); } diff --git a/src/net/common/senderhelper.cpp b/src/net/common/senderhelper.cpp index 3fa2e59a..216a8ec5 100644 --- a/src/net/common/senderhelper.cpp +++ b/src/net/common/senderhelper.cpp @@ -66,7 +66,6 @@ class SendDataManager void SendDataManager::HandleWrite(boost::shared_ptr socket, const boost::system::error_code &error) { - // TODO error handling if (!error) AsyncSendNextPacket(socket, true); } diff --git a/src/net/common/serveraccepthelper.cpp b/src/net/common/serveraccepthelper.cpp index da9245c2..52e6f681 100644 --- a/src/net/common/serveraccepthelper.cpp +++ b/src/net/common/serveraccepthelper.cpp @@ -24,8 +24,6 @@ #include -#define NET_SERVER_LISTEN_BACKLOG 20 - using namespace std; using boost::asio::ip::tcp; @@ -75,15 +73,15 @@ ServerAcceptHelper::InternalListen(unsigned serverPort, bool ipv6, bool sctp) else m_endpoint.reset(new tcp::endpoint(tcp::v4(), serverPort)); - // TODO use non blocking I/O + m_acceptor->open(m_endpoint->protocol()); + // TODO cannot set non blocking I/O with asio. //boost::asio::socket_base::non_blocking_io command(true); //m_acceptor->io_control(command); - m_acceptor->open(m_endpoint->protocol()); m_acceptor->set_option(tcp::acceptor::reuse_address(true)); if (ipv6) // In IPv6 mode: Be compatible with IPv4. m_acceptor->set_option(boost::asio::ip::v6_only(false)); m_acceptor->bind(*m_endpoint); - m_acceptor->listen(NET_SERVER_LISTEN_BACKLOG); + m_acceptor->listen(); // Start first asynchronous Accept. boost::shared_ptr newSocket(new tcp::socket(*m_ioService)); diff --git a/src/net/common/servergamestate.cpp b/src/net/common/servergamestate.cpp index 9cabdc53..2c640a96 100644 --- a/src/net/common/servergamestate.cpp +++ b/src/net/common/servergamestate.cpp @@ -64,10 +64,9 @@ using namespace std; #define SERVER_GAME_ADMIN_WARNING_REMAINING_SEC 60 #define SERVER_GAME_ADMIN_TIMEOUT_SEC 300 // 5 min, MUST be > SERVER_GAME_ADMIN_WARNING_REMAINING_SEC #define SERVER_VOTE_KICK_TIMEOUT_SEC 30 -#define SERVER_LOOP_DELAY_MSEC 20 +#define SERVER_LOOP_DELAY_MSEC 50 // Helper functions -// TODO: these are hacks. static void SendPlayerAction(ServerGame &server, boost::shared_ptr player) { @@ -88,7 +87,6 @@ static void SendPlayerAction(ServerGame &server, boost::shared_ptr