Skip to content

Commit

Permalink
disable agent
Browse files Browse the repository at this point in the history
  • Loading branch information
fredriklindberg committed Mar 23, 2024
1 parent 112d035 commit 68bdefa
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions src/ingress/http-ingress.ts
Original file line number Diff line number Diff line change
Expand Up @@ -361,8 +361,30 @@ export default class HttpIngress implements IngressBase {
clientRes.pipe(res);
});

res.once('error', (err: any) => {
this.logger.withContext("tunnel", tunnel.id).debug({
message: `upstream response error: ${err.message}`
});
});

const close = () => {
clientReq.removeAllListeners('error');
clientReq.removeAllListeners('close');
clientReq.destroy();
};

clientReq.once('timeout', () => {
this.logger.withContext("tunnel", tunnel.id).debug({
message: `http request timeout`,
});
clientReq.end();
});

clientReq.once('close', () => {
agent.activeTunnelConnections = Math.max(agent.activeTunnelConnections - 1, 0);
this.logger.withContext("tunnel", tunnel.id).debug({
message: `http request closed: ${agent.activeTunnelConnections} active connections`,
});
});

clientReq.on('error', (err: any) => {
Expand Down

0 comments on commit 68bdefa

Please sign in to comment.