(code)
| 592 | // At this point the underlying node::http2:Http2Stream handle is no |
| 593 | // longer usable so destroy it also. |
| 594 | function onStreamClose(code) { |
| 595 | const stream = this[kOwner]; |
| 596 | if (!stream || stream.destroyed) |
| 597 | return false; |
| 598 | |
| 599 | debugStreamObj( |
| 600 | stream, 'closed with code %d, closed %s, readable %s', |
| 601 | code, stream.closed, stream.readable, |
| 602 | ); |
| 603 | |
| 604 | if (!stream.closed) |
| 605 | closeStream(stream, code, kNoRstStream); |
| 606 | |
| 607 | stream[kState].fd = -1; |
| 608 | // Defer destroy we actually emit end. |
| 609 | if (!stream.readable || code !== NGHTTP2_NO_ERROR) { |
| 610 | // If errored or ended, we can destroy immediately. |
| 611 | stream.destroy(); |
| 612 | } else { |
| 613 | // Wait for end to destroy. |
| 614 | stream.on('end', stream[kMaybeDestroy]); |
| 615 | // Push a null so the stream can end whenever the client consumes |
| 616 | // it completely. |
| 617 | stream.push(null); |
| 618 | |
| 619 | // If the user hasn't tried to consume the stream (and this is a server |
| 620 | // session) then just dump the incoming data so that the stream can |
| 621 | // be destroyed. |
| 622 | if (stream[kSession][kType] === NGHTTP2_SESSION_SERVER && |
| 623 | !stream[kState].didRead && |
| 624 | stream.readableFlowing === null) |
| 625 | stream.resume(); |
| 626 | else |
| 627 | stream.read(0); |
| 628 | } |
| 629 | return true; |
| 630 | } |
| 631 | |
| 632 | // Called when the remote peer settings have been updated. |
| 633 | // Resets the cached settings. |
nothing calls this directly
no test coverage detected