[Node] Fallback client implementation

This commit is contained in:
momo5502 2016-11-15 16:40:15 +01:00
parent 6f85105902
commit d4e78a09a5
3 changed files with 18 additions and 0 deletions

View File

@ -173,6 +173,8 @@ namespace Components
if (!Loader::PerformingUnitTests())
{
Node::LoadNodeRemotePreset();
while (!News::Terminate)
{
News::CheckForUpdate();

View File

@ -8,6 +8,20 @@ namespace Components
std::vector<Node::NodeEntry> Node::Nodes;
std::vector<Node::ClientSession> Node::Sessions;
void Node::LoadNodeRemotePreset()
{
std::string nodes = Utils::WebIO("IW4x", "https://iw4xcachep26muba.onion.to/iw4/nodex.txt").SetTimeout(5000)->Get();
if (nodes.empty()) return;
auto nodeList = Utils::String::Explode(nodes, '\n');
for (auto node : nodeList)
{
Utils::String::Replace(node, "\r", "");
node = Utils::String::Trim(node);
Node::AddNode(node);
}
}
void Node::LoadNodePreset()
{
Proto::Node::List list;

View File

@ -28,6 +28,8 @@ namespace Components
static unsigned int GetValidNodeCount();
static void LoadNodeRemotePreset();
private:
enum EntryState
{