Preparing new send engine.
This commit is contained in:
@@ -0,0 +1,26 @@
|
||||
/***************************************************************************
|
||||
* Copyright (C) 2009 by Lothar May *
|
||||
* *
|
||||
* This program is free software; you can redistribute it and/or modify *
|
||||
* it under the terms of the GNU General Public License as published by *
|
||||
* the Free Software Foundation; either version 2 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 General Public License for more details. *
|
||||
* *
|
||||
* You should have received a copy of the GNU General Public License *
|
||||
* along with this program; if not, write to the *
|
||||
* Free Software Foundation, Inc., *
|
||||
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
|
||||
***************************************************************************/
|
||||
|
||||
#include <net/senderinterface.h>
|
||||
|
||||
|
||||
SenderInterface::~SenderInterface()
|
||||
{
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/***************************************************************************
|
||||
* Copyright (C) 2007 by Lothar May *
|
||||
* Copyright (C) 2007-2009 by Lothar May *
|
||||
* *
|
||||
* This program is free software; you can redistribute it and/or modify *
|
||||
* it under the terms of the GNU General Public License as published by *
|
||||
@@ -44,6 +44,24 @@ SenderThread::~SenderThread()
|
||||
{
|
||||
}
|
||||
|
||||
void
|
||||
SenderThread::Start()
|
||||
{
|
||||
Run();
|
||||
}
|
||||
|
||||
void
|
||||
SenderThread::SignalStop()
|
||||
{
|
||||
SignalTermination();
|
||||
}
|
||||
|
||||
void
|
||||
SenderThread::WaitStop()
|
||||
{
|
||||
Join(SENDER_THREAD_TERMINATE_TIMEOUT);
|
||||
}
|
||||
|
||||
void
|
||||
SenderThread::Send(boost::shared_ptr<SessionData> session, boost::shared_ptr<NetPacket> packet)
|
||||
{
|
||||
|
||||
@@ -772,7 +772,7 @@ ServerGameThread::SetStateTimerFlag(unsigned flag)
|
||||
m_stateTimerFlag = flag;
|
||||
}
|
||||
|
||||
SenderThread &
|
||||
SenderInterface &
|
||||
ServerGameThread::GetSender()
|
||||
{
|
||||
return GetLobbyThread().GetSender();
|
||||
|
||||
@@ -344,7 +344,7 @@ ServerLobbyThread::GetNextGameId()
|
||||
void
|
||||
ServerLobbyThread::Main()
|
||||
{
|
||||
GetSender().Run();
|
||||
GetSender().Start();
|
||||
|
||||
try
|
||||
{
|
||||
@@ -379,9 +379,8 @@ ServerLobbyThread::Main()
|
||||
|
||||
TerminateGames();
|
||||
|
||||
GetSender().SignalTermination();
|
||||
|
||||
GetSender().Join(SENDER_THREAD_TERMINATE_TIMEOUT);
|
||||
GetSender().SignalStop();
|
||||
GetSender().WaitStop();
|
||||
|
||||
CleanupConnectQueue();
|
||||
}
|
||||
@@ -1291,7 +1290,7 @@ ServerLobbyThread::GetCallback()
|
||||
return m_gui;
|
||||
}
|
||||
|
||||
SenderThread &
|
||||
SenderInterface &
|
||||
ServerLobbyThread::GetSender()
|
||||
{
|
||||
assert(m_sender.get());
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/***************************************************************************
|
||||
* Copyright (C) 2007 by Lothar May *
|
||||
* Copyright (C) 2007-2009 by Lothar May *
|
||||
* *
|
||||
* This program is free software; you can redistribute it and/or modify *
|
||||
* it under the terms of the GNU General Public License as published by *
|
||||
@@ -18,7 +18,7 @@
|
||||
***************************************************************************/
|
||||
|
||||
#include <net/sessionmanager.h>
|
||||
#include <net/senderthread.h>
|
||||
#include <net/senderinterface.h>
|
||||
#include <net/serverexception.h>
|
||||
#include <net/socket_msg.h>
|
||||
|
||||
@@ -357,7 +357,7 @@ SessionManager::GetRawSessionCount()
|
||||
}
|
||||
|
||||
void
|
||||
SessionManager::SendToAllSessions(SenderThread &sender, boost::shared_ptr<NetPacket> packet, SessionData::State state)
|
||||
SessionManager::SendToAllSessions(SenderInterface &sender, boost::shared_ptr<NetPacket> packet, SessionData::State state)
|
||||
{
|
||||
boost::recursive_mutex::scoped_lock lock(m_sessionMapMutex);
|
||||
|
||||
@@ -377,7 +377,7 @@ SessionManager::SendToAllSessions(SenderThread &sender, boost::shared_ptr<NetPac
|
||||
}
|
||||
|
||||
void
|
||||
SessionManager::SendLobbyMsgToAllSessions(SenderThread &sender, boost::shared_ptr<NetPacket> packet, SessionData::State state)
|
||||
SessionManager::SendLobbyMsgToAllSessions(SenderInterface &sender, boost::shared_ptr<NetPacket> packet, SessionData::State state)
|
||||
{
|
||||
boost::recursive_mutex::scoped_lock lock(m_sessionMapMutex);
|
||||
|
||||
@@ -397,7 +397,7 @@ SessionManager::SendLobbyMsgToAllSessions(SenderThread &sender, boost::shared_pt
|
||||
}
|
||||
|
||||
void
|
||||
SessionManager::SendToAllButOneSessions(SenderThread &sender, boost::shared_ptr<NetPacket> packet, SessionId except, SessionData::State state)
|
||||
SessionManager::SendToAllButOneSessions(SenderInterface &sender, boost::shared_ptr<NetPacket> packet, SessionId except, SessionData::State state)
|
||||
{
|
||||
boost::recursive_mutex::scoped_lock lock(m_sessionMapMutex);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user