Skip to content

Commit

Permalink
Merge pull request #167 from lipsumar/silence-h1-socket-error-unless-…
Browse files Browse the repository at this point in the history
…debug

Only log socket errors if debug is enabled
  • Loading branch information
pimterry authored Apr 5, 2024
2 parents 3ba48ad + a242180 commit 64091fc
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/server/http-combo-server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -273,7 +273,11 @@ export async function createComboServer(
function handleH1Connect(req: http.IncomingMessage, socket: net.Socket) {
// Clients may disconnect at this point (for all sorts of reasons), but here
// nothing else is listening, so we need to catch errors on the socket:
socket.once('error', (e) => console.log('Error on client socket', e));
socket.once('error', (e) => {
if (options.debug) {
console.log('Error on client socket', e);
}
});

const connectUrl = req.url || req.headers['host'];
if (!connectUrl) {
Expand Down

0 comments on commit 64091fc

Please # to comment.