Merge pull request #213 from rom1504/kick_client_when_wrong_version

[WIP] Kick client when he is using the wrong version of the client, fix #209
This commit is contained in:
Robin Lambertz 2015-09-24 13:58:04 +02:00
commit da3a241775
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) {