mirror of
https://github.com/unmojang/node-minecraft-protocol.git
synced 2025-09-28 13:45:37 -04:00
Only look for SRV records if necessary
Vanilla client implementation only looks for SRV records when the server port isn't specified, so let's mirror that behavior.
This commit is contained in:
parent
d0664f37b4
commit
88255413ce
@ -70,13 +70,17 @@ Client.prototype.setSocket = function(socket) {
|
||||
|
||||
Client.prototype.connect = function(port, host) {
|
||||
var self = this;
|
||||
dns.resolveSrv("_minecraft._tcp." + host, function(err, addresses) {
|
||||
if (addresses) {
|
||||
self.setSocket(net.connect(addresses[0].port, addresses[0].name));
|
||||
} else {
|
||||
self.setSocket(net.connect(port, host));
|
||||
}
|
||||
});
|
||||
if (port == 25565) {
|
||||
dns.resolveSrv("_minecraft._tcp." + host, function(err, addresses) {
|
||||
if (addresses) {
|
||||
self.setSocket(net.connect(addresses[0].port, addresses[0].name));
|
||||
} else {
|
||||
self.setSocket(net.connect(port, host));
|
||||
}
|
||||
});
|
||||
} else {
|
||||
self.setSocket(net.connect(port, host));
|
||||
}
|
||||
};
|
||||
|
||||
Client.prototype.end = function(reason) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user