Skip to content

Commit

Permalink
connection: ignore window updates after end stream
Browse files Browse the repository at this point in the history
  • Loading branch information
dougwilson committed May 23, 2017
1 parent faa0e09 commit 11af8fc
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 0 deletions.
4 changes: 4 additions & 0 deletions lib/spdy-transport/connection.js
Original file line number Diff line number Diff line change
Expand Up @@ -307,6 +307,10 @@ Connection.prototype._handleFrame = function _handleFrame (frame) {
// Other side should destroy the stream upon receiving GOAWAY
if (this._isGoaway(frame.id)) { return }

// Ignore WINDOW_UPDATE frames from closed streams
if (frame.type === 'WINDOW_UPDATE' &&
frame.id <= state.stream.lastId.received) { return }

state.debug('id=0 stream=%d not found', frame.id)
state.framer.rstFrame({ id: frame.id, code: 'INVALID_STREAM' })
return
Expand Down
24 changes: 24 additions & 0 deletions test/both/transport/connection-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -294,6 +294,30 @@ describe('Transport/Connection', function () {
})
})

it('should ignore WINDOW_UPDATE frame after END_STREAM', function (done) {
client.request({
path: '/hello'
}, function (err, stream) {
assert(!err)

stream.resume()

stream.once('close', function () {
client.on('frame', function (frame) {
assert(!(frame.type === 'RST' && frame.id === 1))
})

client._spdyState.framer.windowUpdateFrame({
id: stream.id,
delta: 1
}, function (err) {
assert(!err)
setTimeout(done, 100)
})
})
})
})

it('should use last received id when killing streams', function (done) {
var waiting = 2
function next () {
Expand Down

0 comments on commit 11af8fc

Please sign in to comment.