One sender thread per client. Requires loads of resources. Kind of hacked, because the internal dependencies are very ugly now. Requires loads of testing. A problem might be the last packet sent by the server to a specific client before closing the connection, for example an error message. It might never even reach the client, because the sender thread is terminated before. I have not yet found a good way to fix this.
This commit is contained in:
@@ -18,15 +18,20 @@
|
||||
***************************************************************************/
|
||||
|
||||
#include <net/sessiondata.h>
|
||||
#include <net/senderthread.h>
|
||||
|
||||
SessionData::SessionData(SOCKET sockfd, SessionId id)
|
||||
SessionData::SessionData(SOCKET sockfd, SessionId id, SenderCallback &cb)
|
||||
: m_sockfd(sockfd), m_id(id), m_state(SessionData::Init), m_readyFlag(false),
|
||||
m_wantsLobbyMsg(true), m_activityTimeoutNoticeSent(false)
|
||||
{
|
||||
m_sender.reset(new SenderThread(cb));
|
||||
m_sender->Start();
|
||||
}
|
||||
|
||||
SessionData::~SessionData()
|
||||
{
|
||||
m_sender->SignalStop();
|
||||
m_sender->WaitStop();
|
||||
if (m_sockfd != INVALID_SOCKET)
|
||||
CLOSESOCKET(m_sockfd);
|
||||
}
|
||||
@@ -122,6 +127,12 @@ SessionData::GetReceiveBuffer()
|
||||
return m_receiveBuffer;
|
||||
}
|
||||
|
||||
SenderInterface &
|
||||
SessionData::GetSender()
|
||||
{
|
||||
return *m_sender;
|
||||
}
|
||||
|
||||
void
|
||||
SessionData::ResetActivityTimer()
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user