Merge pull request #211 from rom1504/keepAliveOption

Keep alive option
This commit is contained in:
Robin Lambertz 2015-08-12 22:28:05 +02:00
commit a4f34a7943
2 changed files with 7 additions and 3 deletions

View File

@ -77,7 +77,8 @@ if(host.indexOf(':') != -1) {
var srv = mc.createServer({
'online-mode': false,
port: 25566
port: 25566,
keepAlive: false
});
srv.on('login', function(client) {
var addr = client.socket.remoteAddress;
@ -101,7 +102,8 @@ srv.on('login', function(client) {
port: port,
username: user,
password: passwd,
'online-mode': passwd != null ? true : false
'online-mode': passwd != null ? true : false,
keepAlive:false
});
var brokenPackets = [/*0x04, 0x2f, 0x30*/];
client.on('packet', function(packet) {

View File

@ -26,6 +26,8 @@ function createServer(options) {
// and returning a modified response object.
var beforePing = options.beforePing || null;
var enableKeepAlive = options.keepAlive == null ? true : options.keepAlive;
var serverKey = ursa.generatePrivateKey(1024);
var server = new Server(options);
@ -194,7 +196,7 @@ function createServer(options) {
client.write(0x02, {uuid: client.uuid, username: client.username});
client.state = states.PLAY;
loggedIn = true;
startKeepAlive();
if(enableKeepAlive) startKeepAlive();
clearTimeout(loginKickTimer);
loginKickTimer = null;