Changeset View
Standalone View
source/network/NetServer.cpp
Show All 20 Lines | |||||
#include "NetClient.h" | #include "NetClient.h" | ||||
#include "NetMessage.h" | #include "NetMessage.h" | ||||
#include "NetSession.h" | #include "NetSession.h" | ||||
#include "NetServerTurnManager.h" | #include "NetServerTurnManager.h" | ||||
#include "NetStats.h" | #include "NetStats.h" | ||||
#include "lib/external_libraries/enet.h" | #include "lib/external_libraries/enet.h" | ||||
#include "network/StunClient.h" | |||||
leper: htonl comment again. | |||||
#include "ps/CLogger.h" | #include "ps/CLogger.h" | ||||
#include "ps/ConfigDB.h" | #include "ps/ConfigDB.h" | ||||
#include "ps/Profile.h" | #include "ps/Profile.h" | ||||
#include "scriptinterface/ScriptInterface.h" | #include "scriptinterface/ScriptInterface.h" | ||||
#include "scriptinterface/ScriptRuntime.h" | #include "scriptinterface/ScriptRuntime.h" | ||||
#include "simulation2/Simulation2.h" | #include "simulation2/Simulation2.h" | ||||
#include "simulation2/system/TurnManager.h" | #include "simulation2/system/TurnManager.h" | ||||
▲ Show 20 Lines • Show All 1,403 Lines • ▼ Show 20 Lines | while (true) | ||||
if (unique) | if (unique) | ||||
return name; | return name; | ||||
name = original + L" (" + CStrW::FromUInt(id++) + L")"; | name = original + L" (" + CStrW::FromUInt(id++) + L")"; | ||||
} | } | ||||
} | } | ||||
void CNetServerWorker::SendHolePunchingMessage(const CStr& ipStr, u16 port) | |||||
Not Done Inline ActionsWe do have quite similar code in the scriptinterface, is that duplicated, and if it is it would be nice to put all of that in one place so we don't have the same include/undef combination multiple times. leper: We do have quite similar code in the scriptinterface, is that duplicated, and if it is it would… | |||||
Not Done Inline Actions
Yes, the duplicate code in ScriptFunctions.cpp was one of the expiremental changes (see #2305#comment:37) which I done in the fastest way possible, since I wasn't sure whether they will stay or I will revert them later.
fcxSanya: > We do have quite similar code in the scriptinterface, is that duplicated
Yes, the duplicate… | |||||
{ | |||||
StunClient::SendHolePunchingMessages(m_Host, ipStr.c_str(), port); | |||||
} | |||||
CNetServer::CNetServer(int autostartPlayers) : | CNetServer::CNetServer(int autostartPlayers) : | ||||
m_Worker(new CNetServerWorker(autostartPlayers)) | m_Worker(new CNetServerWorker(autostartPlayers)) | ||||
{ | { | ||||
} | } | ||||
Not Done Inline ActionsThis (3 messages with delays from both sides) was a quick test, which turned out to be working, going to replace the copy-pasted statements with a loop. fcxSanya: This (3 messages with delays from both sides) was a quick test, which turned out to be working… | |||||
Not Done Inline Actions
Fixed in 29d5116 fcxSanya: > going to replace the copy-pasted statements with a loop
Fixed in [29d5116](https://github. | |||||
CNetServer::~CNetServer() | CNetServer::~CNetServer() | ||||
{ | { | ||||
delete m_Worker; | delete m_Worker; | ||||
} | } | ||||
bool CNetServer::SetupConnection(const u16 port) | bool CNetServer::SetupConnection(const u16 port) | ||||
{ | { | ||||
Show All 16 Lines | void CNetServer::UpdateGameAttributes(JS::MutableHandleValue attrs, ScriptInterface& scriptInterface) | ||||
m_Worker->m_GameAttributesQueue.push_back(attrsJSON); | m_Worker->m_GameAttributesQueue.push_back(attrsJSON); | ||||
} | } | ||||
void CNetServer::SetTurnLength(u32 msecs) | void CNetServer::SetTurnLength(u32 msecs) | ||||
{ | { | ||||
CScopeLock lock(m_Worker->m_WorkerMutex); | CScopeLock lock(m_Worker->m_WorkerMutex); | ||||
m_Worker->m_TurnLengthQueue.push_back(msecs); | m_Worker->m_TurnLengthQueue.push_back(msecs); | ||||
} | } | ||||
void CNetServer::SendHolePunchingMessage(const CStr& ip, u16 port) | |||||
{ | |||||
Not Done Inline Actions\n{ leper: `\n{` | |||||
m_Worker->SendHolePunchingMessage(ip, port); | |||||
} |
htonl comment again.