mirror of
https://github.com/zerotier/ZeroTierOne.git
synced 2025-06-05 03:53:44 +02:00
.
This commit is contained in:
parent
fd3916a49e
commit
ab27a91b07
1 changed files with 7 additions and 7 deletions
|
@ -4,15 +4,13 @@
|
||||||
// Customizable parameters:
|
// Customizable parameters:
|
||||||
|
|
||||||
// Maximum interval between test attempts
|
// Maximum interval between test attempts
|
||||||
//var TEST_INTERVAL_MAX = (60 * 1 * 1000);
|
var TEST_INTERVAL_MAX = 60000;
|
||||||
var TEST_INTERVAL_MAX = 1000;
|
|
||||||
|
|
||||||
// Test timeout in ms
|
// Test timeout in ms
|
||||||
var TEST_TIMEOUT = 30000;
|
var TEST_TIMEOUT = 30000;
|
||||||
|
|
||||||
// Where should I contact to register and query a list of other test agents?
|
// Where should I contact to register and query a list of other test agents?
|
||||||
var SERVER_HOST = '127.0.0.1';
|
var SERVER_HOST = '104.238.141.145';
|
||||||
//var SERVER_HOST = '104.238.141.145';
|
|
||||||
var SERVER_PORT = 18080;
|
var SERVER_PORT = 18080;
|
||||||
|
|
||||||
// Which port should agents use for their HTTP?
|
// Which port should agents use for their HTTP?
|
||||||
|
@ -118,9 +116,11 @@ function doTest()
|
||||||
} catch (e) {}
|
} catch (e) {}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (allOtherAgents.length > 0) {
|
if (allOtherAgents.length > 1) {
|
||||||
|
|
||||||
var target = allOtherAgents[Math.floor(Math.random() * allOtherAgents.length)];
|
var target = allOtherAgents[Math.floor(Math.random() * allOtherAgents.length)];
|
||||||
|
while (target === thisAgentId)
|
||||||
|
target = allOtherAgents[Math.floor(Math.random() * allOtherAgents.length)];
|
||||||
|
|
||||||
var testRequest = null;
|
var testRequest = null;
|
||||||
var timeoutId = null;
|
var timeoutId = null;
|
||||||
|
@ -128,7 +128,7 @@ function doTest()
|
||||||
if (testRequest !== null)
|
if (testRequest !== null)
|
||||||
testRequest.abort();
|
testRequest.abort();
|
||||||
timeoutId = null;
|
timeoutId = null;
|
||||||
});
|
},TEST_TIMEOUT);
|
||||||
var startTime = Date.now();
|
var startTime = Date.now();
|
||||||
|
|
||||||
testRequest = http.get({
|
testRequest = http.get({
|
||||||
|
@ -166,7 +166,7 @@ function doTest()
|
||||||
});
|
});
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
return setTimeout(doTest,Math.round(Math.random() * TEST_INTERVAL_MAX) + 1);
|
return setTimeout(doTest,1000);
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
Loading…
Add table
Reference in a new issue