[go: nahoru, domu]

Skip to content

Commit

Permalink
Merge branch 'SirCmpwn-fix-send-on-disconnect'
Browse files Browse the repository at this point in the history
Updated patch to use the readyState constant even in the tests.
  • Loading branch information
samhed committed Apr 30, 2016
2 parents 32df3fd + cf0623f commit 3120c9b
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
2 changes: 1 addition & 1 deletion include/websock.js
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ function Websock() {
}

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._sQlen = 0;
}
Expand Down
1 change: 1 addition & 0 deletions tests/test.websock.js
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,7 @@ describe('Websock', function() {
it('should actually send on the websocket if the websocket does not have too much buffered', function () {
sock.maxBufferedAmount = 10;
sock._websocket.bufferedAmount = 8;
sock._websocket.readyState = WebSocket.OPEN
sock._sQ = new Uint8Array([1, 2, 3]);
sock._sQlen = 3;
var encoded = sock._encode_message();
Expand Down

0 comments on commit 3120c9b

Please sign in to comment.