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

Method constructor

lib/internal/http2/core.js:2074–2111  ·  view source on GitHub ↗
(session, options)

Source from the content-addressed store, hash-verified

2072// node::http2::Http2Stream handle implementing StreamBase.
2073class Http2Stream extends Duplex {
2074 constructor(session, options) {
2075 options.allowHalfOpen = true;
2076 options.decodeStrings = false;
2077 options.autoDestroy = false;
2078 super(options);
2079 this[async_id_symbol] = -1;
2080
2081 // Corking the stream automatically allows writes to happen
2082 // but ensures that those are buffered until the handle has
2083 // been assigned.
2084 this.cork();
2085 this[kSession] = session;
2086 session[kState].pendingStreams.add(this);
2087
2088 // Allow our logic for determining whether any reads have happened to
2089 // work in all situations. This is similar to what we do in _http_incoming.
2090 this._readableState.readingMore = true;
2091
2092 this[kTimeout] = null;
2093
2094 this[kState] = {
2095 didRead: false,
2096 flags: STREAM_FLAGS_PENDING,
2097 rstCode: NGHTTP2_NO_ERROR,
2098 writeQueueSize: 0,
2099 trailersReady: false,
2100 endAfterHeaders: false,
2101 };
2102
2103 // Fields used by the compat API to avoid megamorphisms.
2104 this[kRequest] = null;
2105 this[kProxySocket] = null;
2106
2107 this.on('pause', streamOnPause);
2108
2109 this.on('newListener', streamListenerAdded);
2110 this.on('removeListener', streamListenerRemoved);
2111 }
2112
2113 [kUpdateTimer]() {
2114 if (this.destroyed)

Callers

nothing calls this directly

Calls 3

corkMethod · 0.80
addMethod · 0.65
onMethod · 0.45

Tested by

no test coverage detected