mirror of
https://github.com/unmojang/node-minecraft-protocol.git
synced 2025-09-29 14:13:45 -04:00
Fix a scope leak which caused tests to fail. Fixes #20
This commit is contained in:
parent
ebc6af6a7e
commit
4a7b1e48cd
3
index.js
3
index.js
@ -101,6 +101,7 @@ function createServer(options) {
|
|||||||
|
|
||||||
function onHandshake(packet) {
|
function onHandshake(packet) {
|
||||||
client.username = packet.username;
|
client.username = packet.username;
|
||||||
|
var serverId;
|
||||||
if (onlineMode) {
|
if (onlineMode) {
|
||||||
serverId = crypto.randomBytes(4).toString('hex');
|
serverId = crypto.randomBytes(4).toString('hex');
|
||||||
} else {
|
} else {
|
||||||
@ -110,7 +111,7 @@ function createServer(options) {
|
|||||||
client.verifyToken = crypto.randomBytes(4);
|
client.verifyToken = crypto.randomBytes(4);
|
||||||
var publicKeyStrArr = serverKey.toPublicPem("utf8").split("\n");
|
var publicKeyStrArr = serverKey.toPublicPem("utf8").split("\n");
|
||||||
var publicKeyStr = "";
|
var publicKeyStr = "";
|
||||||
for (i=1;i<publicKeyStrArr.length - 2;i++) {
|
for (var i=1;i<publicKeyStrArr.length - 2;i++) {
|
||||||
publicKeyStr += publicKeyStrArr[i]
|
publicKeyStr += publicKeyStrArr[i]
|
||||||
}
|
}
|
||||||
client.publicKey = new Buffer(publicKeyStr,'base64');
|
client.publicKey = new Buffer(publicKeyStr,'base64');
|
||||||
|
Loading…
x
Reference in New Issue
Block a user