Changeset View
Changeset View
Standalone View
Standalone View
source/network/NetServer.cpp
Show First 20 Lines • Show All 1,575 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(2565) ,m_Password("") | ||||
Stan: I think default port is 20595? Any reason you need this default? | |||||
Done Inline Actionsnot really, hmm I thought I removed all "" Silier: not really, hmm I thought I removed all "" | |||||
{ | { | ||||
} | } | ||||
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) | |||||
StanUnsubmitted Done Inline Actionsmake that method const Stan: make that method const
Use CStr8 here and above. | |||||
SilierAuthorUnsubmitted Done Inline Actionswhy CStr8 ? CStr is defined by us and it is CStr8 Silier: why CStr8 ? CStr is defined by us and it is CStr8 | |||||
StanUnsubmitted Done Inline ActionsOh I thought it didn't match the declaration, then it's fine. CStr is a bit tricky, it's a single header that defines two classes. Stuff switches depending on the place it's a real mess. Stan: Oh I thought it didn't match the declaration, then it's fine.
CStr is a bit tricky, it's a… | |||||
{ | |||||
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
I think default port is 20595? Any reason you need this default?