MCPcopy Index your code
hub / github.com/nodejs/node / onGoawayData

Function onGoawayData

lib/internal/http2/core.js:744–769  ·  view source on GitHub ↗
(code, lastStreamID, buf)

Source from the content-addressed store, hash-verified

742// close using the same code then destroy the session with an error.
743// The goaway event will be emitted on next tick.
744function 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
772const deprecateWeight = deprecateProperty('weight',

Callers

nothing calls this directly

Calls 4

debugSessionObjFunction · 0.85
closeMethod · 0.65
emitMethod · 0.45
destroyMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…