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

Commit

Permalink
fix: update log message when socket closes (#249)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
achingbrain committed Jan 26, 2023
1 parent 07a03ac commit f95bbf1
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/socket-to-conn.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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 })
})

Expand Down

0 comments on commit f95bbf1

Please sign in to comment.