Kick client when he is using the wrong version of the client, fix #209

This commit is contained in:
Romain Beaumont 2015-08-08 19:22:32 +02:00
parent f7e50721e8
commit fdc24cbeed
2 changed files with 5 additions and 1 deletions

View File

@ -114,7 +114,7 @@ class Client extends EventEmitter
end(reason) {
this._endReason = reason;
this.socket.end();
if(this.socket) this.socket.end();
}
setEncryption(sharedSecret) {

View File

@ -146,6 +146,10 @@ function createServer(options) {
} else if(packet.nextState == 2) {
client.state = states.LOGIN;
}
if(client.protocolVersion!=version.version)
{
client.end("Wrong protocol version, expected : "+version.version+" and you are using : "+client.protocolVersion);
}
}
function onEncryptionKeyResponse(packet) {