Skip to content

Commit

Permalink
fixup
Browse files Browse the repository at this point in the history
  • Loading branch information
ronag committed Apr 14, 2023
1 parent d6491b5 commit 615a68c
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 9 deletions.
11 changes: 3 additions & 8 deletions lib/client.js
Original file line number Diff line number Diff line change
Expand Up @@ -1066,9 +1066,8 @@ async function connect (client) {
})
}

let socket
try {
socket = await new Promise((resolve, reject) => {
const socket = await new Promise((resolve, reject) => {
client[kConnector]({
host,
hostname,
Expand All @@ -1086,7 +1085,8 @@ async function connect (client) {
})

if (client.destroyed) {
throw new ClientDestroyedError()
util.destroy(socket.on('error', () => {}), new ClientDestroyedError())
return
}

if (!llhttpInstance) {
Expand Down Expand Up @@ -1131,12 +1131,7 @@ async function connect (client) {
}
client.emit('connect', client[kUrl], [client])
} catch (err) {
if (socket) {
util.destroy(socket.on('error', () => {}), err)
}

if (client.destroyed) {
resume(client)
return
}

Expand Down
1 change: 0 additions & 1 deletion types/connector.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ declare namespace buildConnector {
servername?: string
localAddress?: string | null
httpSocket?: Socket,
signal?: AbortSignal,
}

export type Callback = (...args: CallbackArgs) => void
Expand Down

0 comments on commit 615a68c

Please sign in to comment.