Skip to content

Commit

Permalink
fix(node:net/socket): add new destroySoon and `autoSelectFamilyAtte…
Browse files Browse the repository at this point in the history
…mptedAddresses`
  • Loading branch information
pi0 committed Nov 22, 2023
1 parent 2b805b1 commit 311c72b
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/runtime/node/net/socket.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ export class Socket extends Duplex implements net.Socket {
readonly remoteAddress?: string = "";
readonly remoteFamily?: string = "";
readonly remotePort?: number = 0;
readonly autoSelectFamilyAttemptedAddresses = [];
readonly readyState: net.SocketReadyState = "readOnly";

constructor(_options?: net.SocketConstructorOpts) {
Expand Down Expand Up @@ -83,6 +84,10 @@ export class Socket extends Duplex implements net.Socket {
return this;
}

destroySoon() {
this.destroy();
}

resetAndDestroy() {
const err = new Error("ERR_SOCKET_CLOSED");
(err as any).code = "ERR_SOCKET_CLOSED";
Expand Down

0 comments on commit 311c72b

Please sign in to comment.