Move keepAlive/checkTimeoutInterval to client/keepalive

This commit is contained in:
deathcap 2016-01-25 23:24:20 -08:00
parent 20e076ebcf
commit 8c4406b4a2
2 changed files with 7 additions and 4 deletions

View File

@ -1,4 +1,9 @@
module.exports = function(client) { module.exports = function(client, options) {
var keepAlive = options.keepAlive == null ? true : options.keepAlive;
if (!keepAlive) return;
var checkTimeoutInterval = options.checkTimeoutInterval || 10 * 1000;
client.on('keep_alive', onKeepAlive); client.on('keep_alive', onKeepAlive);
var timeout = null; var timeout = null;

View File

@ -37,8 +37,6 @@ function createClient(options) {
assert.ok(options.username, "username is required"); assert.ok(options.username, "username is required");
var haveCredentials = options.password != null || (clientToken != null && options.session != null); var haveCredentials = options.password != null || (clientToken != null && options.session != null);
var keepAlive = options.keepAlive == null ? true : options.keepAlive;
var checkTimeoutInterval = options.checkTimeoutInterval || 10 * 1000;
var optVersion = options.version || require("./version").defaultVersion; var optVersion = options.version || require("./version").defaultVersion;
var mcData=require("minecraft-data")(optVersion); var mcData=require("minecraft-data")(optVersion);
@ -47,7 +45,7 @@ function createClient(options) {
var client = new Client(false,version.majorVersion); var client = new Client(false,version.majorVersion);
client.on('connect', onConnect); client.on('connect', onConnect);
if(keepAlive) keepalive(client); keepalive(client, options);
encrypt(client); encrypt(client);
client.once('success', onLogin); client.once('success', onLogin);
compress(client); compress(client);