Skip to content

Commit

Permalink
Kick client when he is using the wrong version of the client, fix #209
Browse files Browse the repository at this point in the history
  • Loading branch information
rom1504 committed Sep 20, 2015
1 parent 2c93a4e commit 4ae1869
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/client.js
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ Client.prototype.setSocket = function(socket) {

Client.prototype.end = function(reason) {
this._endReason = reason;
this.socket.end();
if(this.socket) this.socket.end();
};

Client.prototype.setEncryption = function(sharedSecret) {
Expand Down
4 changes: 4 additions & 0 deletions src/createServer.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit 4ae1869

Please sign in to comment.