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

Function doSendFD

lib/internal/http2/core.js:2762–2797  ·  view source on GitHub ↗
(session, options, fd, headers, streamOptions, err, stat)

Source from the content-addressed store, hash-verified

2760}
2761
2762function doSendFD(session, options, fd, headers, streamOptions, err, stat) {
2763 if (err) {
2764 this.destroy(err);
2765 return;
2766 }
2767
2768 // This can happen if the stream is destroyed or closed while we are waiting
2769 // for the file descriptor to be opened or the stat call to be completed.
2770 // In either case, we do not want to continue because the we are shutting
2771 // down and should not attempt to send any data.
2772 if (this.destroyed || this.closed) {
2773 this.destroy(new ERR_HTTP2_INVALID_STREAM());
2774 return;
2775 }
2776
2777 const statOptions = {
2778 offset: options.offset !== undefined ? options.offset : 0,
2779 length: options.length !== undefined ? options.length : -1,
2780 };
2781
2782 // options.statCheck is a user-provided function that can be used to
2783 // verify stat values, override or set headers, or even cancel the
2784 // response operation. If statCheck explicitly returns false, the
2785 // response is canceled. The user code may also send a separate type
2786 // of response so check again for the HEADERS_SENT flag
2787 if ((typeof options.statCheck === 'function' &&
2788 options.statCheck.call(this, stat, headers, statOptions) === false) ||
2789 (this[kState].flags & STREAM_FLAGS_HEADERS_SENT)) {
2790 return;
2791 }
2792
2793 processRespondWithFD(this, fd, headers,
2794 statOptions.offset | 0,
2795 statOptions.length | 0,
2796 streamOptions);
2797}
2798
2799function doSendFileFD(session, options, fd, headers, streamOptions, err, stat) {
2800 const onError = options.onError;

Callers

nothing calls this directly

Calls 3

processRespondWithFDFunction · 0.85
destroyMethod · 0.45
callMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…