gajus / gajus/http-terminator

Does the order of event handlers matter?

Open
#26 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
TypeScript
Stars
335
Forks
29
PR merge metrics
No merged PRs in 30d

Description

I'm writing a http connect forwarding proxy. And we have to handle the `connect` event.

This library associated a `connection` event that will eventually either destroy the socket, or handle a `close` event on the sockets.

Does it matter in what order the event handlers are added?

Furthermore if my event handler, is asynchronous, and awaits for various operations, such as establishing a connection to the target server, then it's possible that the socket created here is left dangling, or even the client socket is destroyed, while I attempt to write to it later.

How do I handle the problem where `stop` is run, while in the middle of an asynchronous request handler, do we just allow these exceptions to be thrown?

Contributor guide

No contributing guide indexed for this repository

Research direction

The issue names the connect, connection, close, and stop lifecycle events but no files or tests. Start by locating the event-handling and termination entry points, then trace how asynchronous handlers interact with socket cleanup. Done means the supported ordering and behavior during an in-flight request are clearly documented, including how callers should handle termination errors.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
backend, networking
Issue type
Documentation
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
20/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.