Merge branch 'master' of https://github.com/Cryptkeeper/Minetrack into uplot
This commit is contained in:
commit
5c346b3dd6
10
lib/dns.js
10
lib/dns.js
@ -38,7 +38,9 @@ class DNSResolver {
|
|||||||
callbackFired = true
|
callbackFired = true
|
||||||
|
|
||||||
// Send currentTime - startTime to provide remaining connectionTime allowance
|
// Send currentTime - startTime to provide remaining connectionTime allowance
|
||||||
callback(ip || this._ip, port || this._port, TimeTracker.getEpochMillis() - startTime)
|
const remainingTime = config.rates.connectTimeout - (TimeTracker.getEpochMillis() - startTime)
|
||||||
|
|
||||||
|
callback(ip || this._ip, port || this._port, remainingTime)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -53,12 +55,12 @@ class DNSResolver {
|
|||||||
// Test if the error indicates a miss, or if the records returned are empty
|
// Test if the error indicates a miss, or if the records returned are empty
|
||||||
if ((err && (err.code === 'ENOTFOUND' || err.code === 'ENODATA')) || !records || records.length === 0) {
|
if ((err && (err.code === 'ENOTFOUND' || err.code === 'ENODATA')) || !records || records.length === 0) {
|
||||||
// Compare config.skipSrvTimeout directly since SKIP_SRV_TIMEOUT has an or'd value
|
// Compare config.skipSrvTimeout directly since SKIP_SRV_TIMEOUT has an or'd value
|
||||||
// isValidSkipSrvTimeout == whether the config has a valid skipSrvTimeout value set
|
// isSkipSrvTimeoutDisabled == whether the config has a valid skipSrvTimeout value set
|
||||||
const isValidSkipSrvTimeout = typeof config.skipSrvTimeout === 'number' && config.skipSrvTimeout > 0
|
const isSkipSrvTimeoutDisabled = typeof config.skipSrvTimeout === 'number' && config.skipSrvTimeout === 0
|
||||||
|
|
||||||
// Only activate _skipSrv if the skipSrvTimeout value is either NaN or > 0
|
// Only activate _skipSrv if the skipSrvTimeout value is either NaN or > 0
|
||||||
// 0 represents a disabled flag
|
// 0 represents a disabled flag
|
||||||
if (!this._isSkipSrv() && isValidSkipSrvTimeout) {
|
if (!this._isSkipSrv() && !isSkipSrvTimeoutDisabled) {
|
||||||
this._skipSrv()
|
this._skipSrv()
|
||||||
|
|
||||||
logger.log('warn', 'No SRV records were resolved for %s. Minetrack will skip attempting to resolve %s SRV records for %d minutes.', this._ip, this._ip, SKIP_SRV_TIMEOUT / (60 * 1000))
|
logger.log('warn', 'No SRV records were resolved for %s. Minetrack will skip attempting to resolve %s SRV records for %d minutes.', this._ip, this._ip, SKIP_SRV_TIMEOUT / (60 * 1000))
|
||||||
|
@ -12,7 +12,7 @@ const config = require('../config')
|
|||||||
function ping (serverRegistration, timeout, callback, version) {
|
function ping (serverRegistration, timeout, callback, version) {
|
||||||
switch (serverRegistration.data.type) {
|
switch (serverRegistration.data.type) {
|
||||||
case 'PC':
|
case 'PC':
|
||||||
serverRegistration.dnsResolver.unfurlSrv((host, port, remainingTimeout) => {
|
serverRegistration.dnsResolver.resolve((host, port, remainingTimeout) => {
|
||||||
const server = new minecraftJavaPing.MinecraftServer(host, port || 25565)
|
const server = new minecraftJavaPing.MinecraftServer(host, port || 25565)
|
||||||
|
|
||||||
server.resolve(remainingTimeout, version, (err, res) => {
|
server.resolve(remainingTimeout, version, (err, res) => {
|
||||||
|
Loading…
Reference in New Issue
Block a user