(client)
| 54567 | client[kQueue][client[kRunningIdx]++] = null; |
| 54568 | errorRequest(client, request3, err); |
| 54569 | } |
| 54570 | client[kPendingIdx] = client[kRunningIdx]; |
| 54571 | assert2(client[kRunning] === 0); |
| 54572 | client.emit("disconnect", client[kUrl], [client], err); |
| 54573 | resume2(client); |
| 54574 | } |
| 54575 | async function connect3(client) { |
| 54576 | assert2(!client[kConnecting]); |
| 54577 | assert2(!client[kSocket]); |
| 54578 | let { host, hostname, protocol, port } = client[kUrl]; |
| 54579 | if (hostname[0] === "[") { |
| 54580 | const idx = hostname.indexOf("]"); |
| 54581 | assert2(idx !== -1); |
| 54582 | const ip = hostname.substring(1, idx); |
| 54583 | assert2(net3.isIP(ip)); |
| 54584 | hostname = ip; |
| 54585 | } |
| 54586 | client[kConnecting] = true; |
| 54587 | if (channels.beforeConnect.hasSubscribers) { |
| 54588 | channels.beforeConnect.publish({ |
| 54589 | connectParams: { |
| 54590 | host, |
| 54591 | hostname, |
| 54592 | protocol, |
| 54593 | port, |
| 54594 | servername: client[kServerName], |
| 54595 | localAddress: client[kLocalAddress] |
| 54596 | }, |
| 54597 | connector: client[kConnector] |
| 54598 | }); |
| 54599 | } |
| 54600 | try { |
| 54601 | const socket = await new Promise((resolve, reject) => { |
| 54602 | client[kConnector]({ |
| 54603 | host, |
| 54604 | hostname, |
| 54605 | protocol, |
| 54606 | port, |
| 54607 | servername: client[kServerName], |
| 54608 | localAddress: client[kLocalAddress] |
| 54609 | }, (err, socket2) => { |
| 54610 | if (err) { |
| 54611 | reject(err); |
| 54612 | } else { |
| 54613 | resolve(socket2); |
| 54614 | } |
| 54615 | }); |
| 54616 | }); |
| 54617 | if (client.destroyed) { |
| 54618 | util4.destroy(socket.on("error", () => { |
| 54619 | }), new ClientDestroyedError()); |
| 54620 | return; |
| 54621 | } |
| 54622 | client[kConnecting] = false; |
| 54623 | assert2(socket); |
| 54624 | const isH2 = socket.alpnProtocol === "h2"; |
| 54625 | if (isH2) { |
| 54626 | if (!h2ExperimentalWarned) { |
no test coverage detected
searching dependent graphs…