(client, request)
| 7244 | }); |
| 7245 | util.addListener(socket, "end", function() { |
| 7246 | util.destroy(this, new SocketError("other side closed", util.getSocketInfo(this))); |
| 7247 | }); |
| 7248 | util.addListener(socket, "close", function() { |
| 7249 | const err = this[kError] || new SocketError("closed", util.getSocketInfo(this)); |
| 7250 | client[kSocket] = null; |
| 7251 | if (this[kHTTP2Session] != null) { |
| 7252 | this[kHTTP2Session].destroy(err); |
| 7253 | } |
| 7254 | client[kPendingIdx] = client[kRunningIdx]; |
| 7255 | assert(client[kRunning] === 0); |
| 7256 | client.emit("disconnect", client[kUrl], [client], err); |
| 7257 | client[kResume](); |
| 7258 | }); |
| 7259 | let closed = false; |
| 7260 | socket.on("close", () => { |
| 7261 | closed = true; |
| 7262 | }); |
| 7263 | return { |
| 7264 | version: "h2", |
| 7265 | defaultPipelining: Infinity, |
| 7266 | write(...args) { |
| 7267 | return writeH2(client, ...args); |
| 7268 | }, |
| 7269 | resume() { |
| 7270 | resumeH2(client); |
| 7271 | }, |
| 7272 | destroy(err, callback) { |
| 7273 | if (closed) { |
| 7274 | queueMicrotask(callback); |
| 7275 | } else { |
| 7276 | socket.destroy(err).on("close", callback); |
| 7277 | } |
| 7278 | }, |
| 7279 | get destroyed() { |
| 7280 | return socket.destroyed; |
| 7281 | }, |
| 7282 | busy() { |
| 7283 | return false; |
| 7284 | } |
| 7285 | }; |
| 7286 | }); |
| 7287 | } |
| 7288 | function resumeH2(client) { |
| 7289 | const socket = client[kSocket]; |
| 7290 | if ((socket == null ? void 0 : socket.destroyed) === false) { |
| 7291 | if (client[kSize] === 0 && client[kMaxConcurrentStreams] === 0) { |
| 7292 | socket.unref(); |
| 7293 | client[kHTTP2Session].unref(); |
| 7294 | } else { |
| 7295 | socket.ref(); |
| 7296 | client[kHTTP2Session].ref(); |
| 7297 | } |
| 7298 | } |
| 7299 | } |
| 7300 | function onHttp2SessionError(err) { |
| 7301 | this[kSocket][kError] = err; |
| 7302 | this[kClient][kOnError](err); |
| 7303 | } |
no test coverage detected