[Node] Regularly store nodes
This commit is contained in:
parent
6eb749cf93
commit
72fe016543
@ -169,6 +169,8 @@ namespace Components
|
||||
|
||||
++i;
|
||||
}
|
||||
|
||||
Node::StoreNodes(false);
|
||||
}
|
||||
|
||||
void Node::Synchronize()
|
||||
@ -250,11 +252,6 @@ namespace Components
|
||||
Session::Send(address, "nodeListResponse", list.SerializeAsString());
|
||||
}
|
||||
|
||||
void Node::HandleRequest(Network::Address address, std::string /*data*/)
|
||||
{
|
||||
Node::SendList(address);
|
||||
}
|
||||
|
||||
unsigned short Node::GetPort()
|
||||
{
|
||||
if (Dvar::Var("net_natFix").get<bool>()) return 0;
|
||||
@ -268,7 +265,10 @@ namespace Components
|
||||
|
||||
Scheduler::OnFrame(Node::RunFrame);
|
||||
Session::Handle("nodeListResponse", Node::HandleResponse);
|
||||
Session::Handle("nodeListRequest", Node::HandleRequest);
|
||||
Session::Handle("nodeListRequest", [](Network::Address address, std::string)
|
||||
{
|
||||
Node::SendList(address);
|
||||
});
|
||||
|
||||
// Load stored nodes
|
||||
auto loadNodes = []()
|
||||
|
@ -47,7 +47,6 @@ namespace Components
|
||||
static std::vector<Entry> Nodes;
|
||||
|
||||
static void HandleResponse(Network::Address address, std::string data);
|
||||
static void HandleRequest(Network::Address address, std::string data);
|
||||
|
||||
static void SendList(Network::Address address);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user