mirror of
https://gitea.wildfiregames.com/0ad/0ad.git
synced 2026-07-25 20:31:58 +00:00
Pass the controllerSecret to the CNet* constructor
It wasn't clear when to call `SetControllerSecret` now it can't be done wrong. Also the mutex has to be locked less often.
This commit is contained in:
@@ -67,13 +67,14 @@ constexpr u32 NETWORK_BAD_PING = DEFAULT_TURN_LENGTH * COMMAND_DELAY_MP / 2;
|
||||
CNetClient *g_NetClient = NULL;
|
||||
|
||||
CNetClient::CNetClient(CGame* game, const CStrW& username, const CStr& hostJID,
|
||||
std::string hashedPassword) :
|
||||
std::string hashedPassword, std::string controllerSecret) :
|
||||
m_UserName{username},
|
||||
m_HostJID{hostJID},
|
||||
m_Game{game},
|
||||
// Hash on top with the user's name, to make sure not all
|
||||
// hashing data is in control of the host.
|
||||
m_Password{HashCryptographically(std::move(hashedPassword), m_UserName.ToUTF8())}
|
||||
m_Password{HashCryptographically(std::move(hashedPassword), m_UserName.ToUTF8())},
|
||||
m_ControllerSecret{std::move(controllerSecret)}
|
||||
{
|
||||
m_Game->SetTurnManager(NULL); // delete the old local turn manager so we don't accidentally use it
|
||||
|
||||
@@ -146,11 +147,6 @@ CNetClient::~CNetClient()
|
||||
DestroyConnection();
|
||||
}
|
||||
|
||||
void CNetClient::SetControllerSecret(const std::string& secret)
|
||||
{
|
||||
m_ControllerSecret = secret;
|
||||
}
|
||||
|
||||
|
||||
bool CNetClient::SetupConnection(ENetHost* enetClient)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user