mirror of
https://github.com/PrismarineJS/node-minecraft-protocol.git
synced 2025-03-28 21:20:23 -04:00
in all case of SRV lookup failure, connect directly
solve issues with tcpshield servers
This commit is contained in:
parent
4a20374082
commit
d20c1a618b
1 changed files with 4 additions and 8 deletions
|
@ -22,13 +22,8 @@ module.exports = function (client, options) {
|
|||
// Error resolving domain
|
||||
if (err) {
|
||||
// Could not resolve SRV lookup, connect directly
|
||||
if (['ENODATA', 'ENOTFOUND', 'ESERVFAIL'].indexOf(err.code) !== -1) {
|
||||
client.setSocket(net.connect(options.port, options.host))
|
||||
return
|
||||
} else {
|
||||
// Something else happened
|
||||
return client.emit('error', err)
|
||||
}
|
||||
client.setSocket(net.connect(options.port, options.host))
|
||||
return
|
||||
}
|
||||
|
||||
// SRV Lookup resolved conrrectly
|
||||
|
@ -37,7 +32,8 @@ module.exports = function (client, options) {
|
|||
options.port = addresses[0].port
|
||||
client.setSocket(net.connect(addresses[0].port, addresses[0].name))
|
||||
} else {
|
||||
client.emit('error', new Error('Could not resolve hostname'))
|
||||
// Otherwise, just connect using the provided hostname and port
|
||||
client.setSocket(net.connect(options.port, options.host))
|
||||
}
|
||||
})
|
||||
} else {
|
||||
|
|
Loading…
Add table
Reference in a new issue