From f95bbf11aa59a184106ea1b1288442160dd0b373 Mon Sep 17 00:00:00 2001 From: Alex Potsides Date: Thu, 26 Jan 2023 09:22:02 +0100 Subject: [PATCH] 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. --- src/socket-to-conn.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/socket-to-conn.ts b/src/socket-to-conn.ts index 579d307..6369f90 100644 --- a/src/socket-to-conn.ts +++ b/src/socket-to-conn.ts @@ -77,7 +77,7 @@ export const toMultiaddrConnection = (socket: Socket, options: ToConnectionOptio }) socket.once('close', () => { - log('%s socket read timeout', lOptsStr) + log('%s socket close', lOptsStr) metrics?.increment({ [`${metricPrefix}close`]: true }) // In instances where `close` was not explicitly called, @@ -91,7 +91,7 @@ export const toMultiaddrConnection = (socket: Socket, options: ToConnectionOptio socket.once('end', () => { // the remote sent a FIN packet which means no more data will be sent // https://nodejs.org/dist/latest-v16.x/docs/api/net.html#event-end - log('socket ended', maConn.remoteAddr.toString()) + log('%s socket end', lOptsStr) metrics?.increment({ [`${metricPrefix}end`]: true }) })