Small fixes. Removing some TODO comments which are no longer valid.
This commit is contained in:
@@ -88,7 +88,6 @@ Game::Game(GuiInterface* gui, boost::shared_ptr<EngineFactory> factory,
|
|||||||
myName = (*player_i)->GetName();
|
myName = (*player_i)->GetName();
|
||||||
myAvatarFile = (*player_i)->GetAvatarFile();
|
myAvatarFile = (*player_i)->GetAvatarFile();
|
||||||
myNetSession = (*player_i)->GetNetSessionData();
|
myNetSession = (*player_i)->GetNetSessionData();
|
||||||
// TODO: set player type
|
|
||||||
++player_i;
|
++player_i;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -3492,8 +3492,6 @@ NetPacketGameStart::SetData(const NetPacketGameStart::Data &inData)
|
|||||||
// Basic checking.
|
// Basic checking.
|
||||||
if (numPlayers < MIN_NUMBER_OF_PLAYERS || numPlayers > MAX_NUMBER_OF_PLAYERS || numPlayers != inData.startData.numberOfPlayers)
|
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 << ".");
|
LOG_VERBOSE("Invalid number of players. Slots: " << numPlayers << ", Players: " << inData.startData.numberOfPlayers << ".");
|
||||||
throw NetException(__FILE__, __LINE__, ERR_NET_INVALID_PLAYER_COUNT, 0);
|
throw NetException(__FILE__, __LINE__, ERR_NET_INVALID_PLAYER_COUNT, 0);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -66,7 +66,6 @@ class SendDataManager
|
|||||||
void
|
void
|
||||||
SendDataManager::HandleWrite(boost::shared_ptr<boost::asio::ip::tcp::socket> socket, const boost::system::error_code &error)
|
SendDataManager::HandleWrite(boost::shared_ptr<boost::asio::ip::tcp::socket> socket, const boost::system::error_code &error)
|
||||||
{
|
{
|
||||||
// TODO error handling
|
|
||||||
if (!error)
|
if (!error)
|
||||||
AsyncSendNextPacket(socket, true);
|
AsyncSendNextPacket(socket, true);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -24,8 +24,6 @@
|
|||||||
#include <core/loghelper.h>
|
#include <core/loghelper.h>
|
||||||
|
|
||||||
|
|
||||||
#define NET_SERVER_LISTEN_BACKLOG 20
|
|
||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
using boost::asio::ip::tcp;
|
using boost::asio::ip::tcp;
|
||||||
|
|
||||||
@@ -75,15 +73,15 @@ ServerAcceptHelper::InternalListen(unsigned serverPort, bool ipv6, bool sctp)
|
|||||||
else
|
else
|
||||||
m_endpoint.reset(new tcp::endpoint(tcp::v4(), serverPort));
|
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);
|
//boost::asio::socket_base::non_blocking_io command(true);
|
||||||
//m_acceptor->io_control(command);
|
//m_acceptor->io_control(command);
|
||||||
m_acceptor->open(m_endpoint->protocol());
|
|
||||||
m_acceptor->set_option(tcp::acceptor::reuse_address(true));
|
m_acceptor->set_option(tcp::acceptor::reuse_address(true));
|
||||||
if (ipv6) // In IPv6 mode: Be compatible with IPv4.
|
if (ipv6) // In IPv6 mode: Be compatible with IPv4.
|
||||||
m_acceptor->set_option(boost::asio::ip::v6_only(false));
|
m_acceptor->set_option(boost::asio::ip::v6_only(false));
|
||||||
m_acceptor->bind(*m_endpoint);
|
m_acceptor->bind(*m_endpoint);
|
||||||
m_acceptor->listen(NET_SERVER_LISTEN_BACKLOG);
|
m_acceptor->listen();
|
||||||
|
|
||||||
// Start first asynchronous Accept.
|
// Start first asynchronous Accept.
|
||||||
boost::shared_ptr<tcp::socket> newSocket(new tcp::socket(*m_ioService));
|
boost::shared_ptr<tcp::socket> newSocket(new tcp::socket(*m_ioService));
|
||||||
|
|||||||
@@ -64,10 +64,9 @@ using namespace std;
|
|||||||
#define SERVER_GAME_ADMIN_WARNING_REMAINING_SEC 60
|
#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_GAME_ADMIN_TIMEOUT_SEC 300 // 5 min, MUST be > SERVER_GAME_ADMIN_WARNING_REMAINING_SEC
|
||||||
#define SERVER_VOTE_KICK_TIMEOUT_SEC 30
|
#define SERVER_VOTE_KICK_TIMEOUT_SEC 30
|
||||||
#define SERVER_LOOP_DELAY_MSEC 20
|
#define SERVER_LOOP_DELAY_MSEC 50
|
||||||
|
|
||||||
// Helper functions
|
// Helper functions
|
||||||
// TODO: these are hacks.
|
|
||||||
|
|
||||||
static void SendPlayerAction(ServerGame &server, boost::shared_ptr<PlayerInterface> player)
|
static void SendPlayerAction(ServerGame &server, boost::shared_ptr<PlayerInterface> player)
|
||||||
{
|
{
|
||||||
@@ -88,7 +87,6 @@ static void SendPlayerAction(ServerGame &server, boost::shared_ptr<PlayerInterfa
|
|||||||
|
|
||||||
static void SendNewRoundCards(ServerGame &server, Game &curGame, int state)
|
static void SendNewRoundCards(ServerGame &server, Game &curGame, int state)
|
||||||
{
|
{
|
||||||
// TODO: no switch needed here if game states are polymorphic
|
|
||||||
switch(state) {
|
switch(state) {
|
||||||
case GAME_STATE_PREFLOP: {
|
case GAME_STATE_PREFLOP: {
|
||||||
// nothing to do
|
// nothing to do
|
||||||
|
|||||||
@@ -433,14 +433,12 @@ void Session::voteKick(bool doKick)
|
|||||||
bool Session::isNetworkClientRunning() const
|
bool Session::isNetworkClientRunning() const
|
||||||
{
|
{
|
||||||
// This, and every place which calls this, is a HACK.
|
// This, and every place which calls this, is a HACK.
|
||||||
// TODO
|
|
||||||
return myNetClient != NULL;
|
return myNetClient != NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Session::isNetworkServerRunning() const
|
bool Session::isNetworkServerRunning() const
|
||||||
{
|
{
|
||||||
// This, and every place which calls this, is a HACK.
|
// This, and every place which calls this, is a HACK.
|
||||||
// TODO
|
|
||||||
return myNetServer != NULL;
|
return myNetServer != NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user