(code, lastStreamID, buf)
| 742 | // close using the same code then destroy the session with an error. |
| 743 | // The goaway event will be emitted on next tick. |
| 744 | function onGoawayData(code, lastStreamID, buf) { |
| 745 | const session = this[kOwner]; |
| 746 | if (session.destroyed) |
| 747 | return; |
| 748 | debugSessionObj(session, 'goaway %d received [last stream id: %d]', |
| 749 | code, lastStreamID); |
| 750 | |
| 751 | const state = session[kState]; |
| 752 | state.goawayCode = code; |
| 753 | state.goawayLastStreamID = lastStreamID; |
| 754 | |
| 755 | session.emit('goaway', code, lastStreamID, buf); |
| 756 | if (code === NGHTTP2_NO_ERROR) { |
| 757 | // If this is a no error goaway, begin shutting down. |
| 758 | // No new streams permitted, but existing streams may |
| 759 | // close naturally on their own. |
| 760 | session.close(); |
| 761 | } else { |
| 762 | // However, if the code is not NGHTTP_NO_ERROR, destroy the |
| 763 | // session immediately. We destroy with an error but send a |
| 764 | // goaway using NGHTTP2_NO_ERROR because there was no error |
| 765 | // condition on this side of the session that caused the |
| 766 | // shutdown. |
| 767 | session.destroy(new ERR_HTTP2_SESSION_ERROR(code), NGHTTP2_NO_ERROR); |
| 768 | } |
| 769 | } |
| 770 | |
| 771 | // TODO(aduh95): remove this in future semver-major |
| 772 | const deprecateWeight = deprecateProperty('weight', |
nothing calls this directly
no test coverage detected
searching dependent graphs…