A few stylistic tweaks.

This commit is contained in:
James Coglan
2015-07-11 14:24:27 +01:00
parent eb5e39e7e3
commit c8e5f1eb78
+8 -9
View File
@@ -5,7 +5,7 @@ var Base = require('./base'),
var Draft75 = function(request, url, options) {
Base.apply(this, arguments);
this._stage = 0;
this._stage = 0;
this.version = 'hixie-75';
this._headers.set('Upgrade', 'WebSocket');
@@ -29,7 +29,7 @@ var instance = {
this._reader.put(chunk);
this._reader.eachByte(function(octet) {
var message, value;
var message;
switch (this._stage) {
case -1:
@@ -42,19 +42,18 @@ var instance = {
break;
case 1:
value = (octet & 0x7F);
this._length = value + 128 * this._length;
this._length = (octet & 0x7F) + 128 * this._length;
if (this._closing && this._length === 0) {
return this.close();
}
else if ((0x80 & octet) !== 0x80) {
else if ((octet & 0x80) !== 0x80) {
if (this._length === 0) {
this._stage = 0;
}
else {
this._skipped = 0;
this._stage = 2;
this._stage = 2;
}
}
break;
@@ -103,14 +102,14 @@ var instance = {
},
_parseLeadingByte: function(octet) {
if ((0x80 & octet) === 0x80) {
if ((octet & 0x80) === 0x80) {
this._length = 0;
this._stage = 1;
this._stage = 1;
} else {
delete this._length;
delete this._skipped;
this._buffer = [];
this._stage = 2;
this._stage = 2;
}
}
};