Skip to content

Commit

Permalink
Log the address connected to
Browse files Browse the repository at this point in the history
  • Loading branch information
rojvv committed Jun 19, 2024
1 parent a182113 commit fed51a5
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 1 deletion.
4 changes: 3 additions & 1 deletion connection/1_connection_tcp.node.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import { Socket } from "node:net";
import { ConnectionError } from "../0_errors.ts";
import { Mutex } from "../1_utilities.ts";
import { getLogger, Mutex } from "../1_utilities.ts";
import { Connection } from "./0_connection.ts";

const L = getLogger("ConnectionTCP");
const errConnectionNotOpen = new ConnectionError("Connection not open");

export class ConnectionTCP implements Connection {
Expand Down Expand Up @@ -63,6 +64,7 @@ export class ConnectionTCP implements Connection {
this.#socket!.off("error", reject);
resolve();
this.stateChangeHandler?.(true);
L.debug("connected to", this.#hostname, "port", this.#port);
},
);
});
Expand Down
1 change: 1 addition & 0 deletions connection/1_connection_tcp.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ export class ConnectionTCP implements Connection {
connection.setKeepAlive(true);
this.#canRead = this.#canWrite = true;
this.stateChangeHandler?.(true);
L.debug("connected to", this.#hostname, "port", this.#port);
Promise.resolve().then(async () => {
do {
try {
Expand Down
1 change: 1 addition & 0 deletions connection/1_connection_web_socket.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ export class ConnectionWebSocket implements Connection {
webSocket.addEventListener("open", () => {
this.stateChangeHandler?.(true);
resolve(webSocket);
L.debug("connected to", this.#url);
});
webSocket.addEventListener("message", async (e) => {
if (typeof e.data === "string") {
Expand Down

0 comments on commit fed51a5

Please sign in to comment.