Changeset View
Changeset View
Standalone View
Standalone View
ps/trunk/source/network/NetServer.cpp
Show First 20 Lines • Show All 1,567 Lines • ▼ Show 20 Lines | if (m_Host) | ||||
StunClient::SendHolePunchingMessages(*m_Host, ipStr, port); | StunClient::SendHolePunchingMessages(*m_Host, ipStr, port); | ||||
} | } | ||||
CNetServer::CNetServer(bool useLobbyAuth, int autostartPlayers) : | CNetServer::CNetServer(bool useLobbyAuth, int autostartPlayers) : | ||||
m_Worker(new CNetServerWorker(useLobbyAuth, autostartPlayers)), | m_Worker(new CNetServerWorker(useLobbyAuth, autostartPlayers)), | ||||
m_LobbyAuth(useLobbyAuth) | m_LobbyAuth(useLobbyAuth), m_UseSTUN(false), m_PublicIp(""), m_PublicPort(20595), m_Password() | ||||
{ | { | ||||
} | } | ||||
CNetServer::~CNetServer() | CNetServer::~CNetServer() | ||||
{ | { | ||||
delete m_Worker; | delete m_Worker; | ||||
} | } | ||||
bool CNetServer::GetUseSTUN() const | |||||
{ | |||||
return m_UseSTUN; | |||||
} | |||||
bool CNetServer::UseLobbyAuth() const | bool CNetServer::UseLobbyAuth() const | ||||
{ | { | ||||
return m_LobbyAuth; | return m_LobbyAuth; | ||||
} | } | ||||
bool CNetServer::SetupConnection(const u16 port) | bool CNetServer::SetupConnection(const u16 port) | ||||
{ | { | ||||
return m_Worker->SetupConnection(port); | return m_Worker->SetupConnection(port); | ||||
} | } | ||||
u16 CNetServer::GetPublicPort() const | |||||
{ | |||||
return m_PublicPort; | |||||
} | |||||
CStr CNetServer::GetPublicIp() const | |||||
{ | |||||
return m_PublicIp; | |||||
} | |||||
void CNetServer::SetConnectionData(const CStr& ip, const u16 port, bool useSTUN) | |||||
{ | |||||
m_PublicIp = ip; | |||||
m_PublicPort = port; | |||||
m_UseSTUN = useSTUN; | |||||
} | |||||
bool CNetServer::CheckPassword(const CStr& password) const | |||||
{ | |||||
return m_Password == password; | |||||
} | |||||
void CNetServer::SetPassword(const CStr& password) | |||||
{ | |||||
m_Password = password; | |||||
} | |||||
void CNetServer::StartGame() | void CNetServer::StartGame() | ||||
{ | { | ||||
std::lock_guard<std::mutex> lock(m_Worker->m_WorkerMutex); | std::lock_guard<std::mutex> lock(m_Worker->m_WorkerMutex); | ||||
m_Worker->m_StartGameQueue.push_back(true); | m_Worker->m_StartGameQueue.push_back(true); | ||||
} | } | ||||
void CNetServer::UpdateGameAttributes(JS::MutableHandleValue attrs, const ScriptInterface& scriptInterface) | void CNetServer::UpdateGameAttributes(JS::MutableHandleValue attrs, const ScriptInterface& scriptInterface) | ||||
{ | { | ||||
Show All 24 Lines |
Wildfire Games · Phabricator