Some changes to make cppcheck happy.
This commit is contained in:
@@ -21,7 +21,6 @@
|
||||
#include <net/clientcontext.h>
|
||||
#include <net/senderhelper.h>
|
||||
#include <net/netpacket.h>
|
||||
#include <net/resolverthread.h>
|
||||
#include <net/clientexception.h>
|
||||
#include <net/socket_helper.h>
|
||||
#include <net/socket_msg.h>
|
||||
|
||||
@@ -1225,24 +1225,6 @@ ClientThread::GetLoginData(LoginData &loginData) const
|
||||
return retVal;
|
||||
}
|
||||
|
||||
unsigned
|
||||
ClientThread::GetGameIdByName(const std::string &name) const
|
||||
{
|
||||
// Find the game.
|
||||
boost::mutex::scoped_lock lock(m_gameInfoMapMutex);
|
||||
GameInfoMap::const_iterator i = m_gameInfoMap.begin();
|
||||
GameInfoMap::const_iterator end = m_gameInfoMap.end();
|
||||
while (i != end) {
|
||||
if (i->second.name == name)
|
||||
break;
|
||||
++i;
|
||||
}
|
||||
|
||||
if (i == end)
|
||||
throw ClientException(__FILE__, __LINE__, ERR_NET_UNKNOWN_GAME, 0);
|
||||
return i->first;
|
||||
}
|
||||
|
||||
void
|
||||
ClientThread::AddGameInfo(unsigned gameId, const GameInfo &info)
|
||||
{
|
||||
|
||||
@@ -1,96 +0,0 @@
|
||||
/*****************************************************************************
|
||||
* PokerTH - The open source texas holdem engine *
|
||||
* Copyright (C) 2006-2011 Felix Hammer, Florian Thauer, Lothar May *
|
||||
* *
|
||||
* This program is free software: you can redistribute it and/or modify *
|
||||
* it under the terms of the GNU Affero General Public License as *
|
||||
* published by the Free Software Foundation, either version 3 of the *
|
||||
* License, or (at your option) any later version. *
|
||||
* *
|
||||
* This program is distributed in the hope that it will be useful, *
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||
* GNU Affero General Public License for more details. *
|
||||
* *
|
||||
* You should have received a copy of the GNU Affero General Public License *
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>. *
|
||||
*****************************************************************************/
|
||||
|
||||
#include <net/socket_helper.h>
|
||||
#include <net/resolverthread.h>
|
||||
#include <net/clientcontext.h>
|
||||
#include <net/clientexception.h>
|
||||
|
||||
#include <sstream>
|
||||
#include <cassert>
|
||||
|
||||
using namespace std;
|
||||
|
||||
|
||||
ResolverThread::ResolverThread()
|
||||
: m_retVal(false)
|
||||
{
|
||||
m_context.reset(new ClientContext);
|
||||
}
|
||||
|
||||
ResolverThread::~ResolverThread()
|
||||
{
|
||||
}
|
||||
|
||||
void
|
||||
ResolverThread::Init(const ClientContext &context)
|
||||
{
|
||||
if (IsRunning())
|
||||
return; // TODO: throw exception
|
||||
|
||||
GetContext().SetAddrFamily(context.GetAddrFamily());
|
||||
GetContext().SetServerAddr(context.GetServerAddr());
|
||||
GetContext().SetServerPort(context.GetServerPort());
|
||||
}
|
||||
|
||||
bool
|
||||
ResolverThread::GetResult(ClientContext &context) const
|
||||
{
|
||||
if (IsRunning())
|
||||
return false; // TODO: throw exception
|
||||
|
||||
if (m_retVal)
|
||||
memcpy(context.GetClientSockaddr(), GetContext().GetClientSockaddr(), GetContext().GetClientSockaddrSize());
|
||||
|
||||
return m_retVal;
|
||||
}
|
||||
|
||||
void
|
||||
ResolverThread::Main()
|
||||
{
|
||||
const ClientContext &context = GetContext();
|
||||
|
||||
// Convert the port to a string.
|
||||
ostringstream tmpStr;
|
||||
tmpStr << context.GetServerPort();
|
||||
|
||||
// Start the name resolution.
|
||||
m_retVal = socket_resolve(
|
||||
context.GetServerAddr().c_str(),
|
||||
tmpStr.str().c_str(),
|
||||
context.GetAddrFamily(),
|
||||
SOCK_STREAM,
|
||||
context.GetProtocol(),
|
||||
(struct sockaddr *)context.GetClientSockaddr(),
|
||||
context.GetClientSockaddrSize());
|
||||
}
|
||||
|
||||
const ClientContext &
|
||||
ResolverThread::GetContext() const
|
||||
{
|
||||
assert(m_context.get());
|
||||
return *m_context;
|
||||
}
|
||||
|
||||
ClientContext &
|
||||
ResolverThread::GetContext()
|
||||
{
|
||||
assert(m_context.get());
|
||||
return *m_context;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user