Merge branch 'SirCmpwn-fix-send-on-disconnect'
Updated patch to use the readyState constant even in the tests.
This commit is contained in:
commit
3120c9b5ec
|
@ -197,7 +197,7 @@ function Websock() {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this._websocket.bufferedAmount < this.maxBufferedAmount) {
|
if (this._websocket.bufferedAmount < this.maxBufferedAmount) {
|
||||||
if (this._sQlen > 0) {
|
if (this._sQlen > 0 && this._websocket.readyState === WebSocket.OPEN) {
|
||||||
this._websocket.send(this._encode_message());
|
this._websocket.send(this._encode_message());
|
||||||
this._sQlen = 0;
|
this._sQlen = 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -173,6 +173,7 @@ describe('Websock', function() {
|
||||||
it('should actually send on the websocket if the websocket does not have too much buffered', function () {
|
it('should actually send on the websocket if the websocket does not have too much buffered', function () {
|
||||||
sock.maxBufferedAmount = 10;
|
sock.maxBufferedAmount = 10;
|
||||||
sock._websocket.bufferedAmount = 8;
|
sock._websocket.bufferedAmount = 8;
|
||||||
|
sock._websocket.readyState = WebSocket.OPEN
|
||||||
sock._sQ = new Uint8Array([1, 2, 3]);
|
sock._sQ = new Uint8Array([1, 2, 3]);
|
||||||
sock._sQlen = 3;
|
sock._sQlen = 3;
|
||||||
var encoded = sock._encode_message();
|
var encoded = sock._encode_message();
|
||||||
|
|
Loading…
Reference in New Issue