Skip to content
This repository was archived by the owner on Aug 29, 2023. It is now read-only.

Commit f95bbf1

Browse files
authored
fix: update log message when socket closes (#249)
This was incorrectly logging as a timeout when it should be logging a close. Also updates end event log for consistency with the other logging.
1 parent 07a03ac commit f95bbf1

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/socket-to-conn.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ export const toMultiaddrConnection = (socket: Socket, options: ToConnectionOptio
7777
})
7878

7979
socket.once('close', () => {
80-
log('%s socket read timeout', lOptsStr)
80+
log('%s socket close', lOptsStr)
8181
metrics?.increment({ [`${metricPrefix}close`]: true })
8282

8383
// In instances where `close` was not explicitly called,
@@ -91,7 +91,7 @@ export const toMultiaddrConnection = (socket: Socket, options: ToConnectionOptio
9191
socket.once('end', () => {
9292
// the remote sent a FIN packet which means no more data will be sent
9393
// https://nodejs.org/dist/latest-v16.x/docs/api/net.html#event-end
94-
log('socket ended', maConn.remoteAddr.toString())
94+
log('%s socket end', lOptsStr)
9595
metrics?.increment({ [`${metricPrefix}end`]: true })
9696
})
9797

0 commit comments

Comments
 (0)