How Stoppable manages connection shutdown
masterStoppable solves the issue where Node's default server.close() might not handle idle keep-alive connections as expected.
Key Behaviors:
- New Connections: Immediately stops accepting new connections.
- Idle Connections: Closes existing idle connections (including keep-alives).
- In-flight Requests: Does not kill requests that are currently being processed.
- Shutdown Mechanism: Instead of simply destroying sockets, it attempts to handle clients respectfully by sending
FINpackets first. - Grace Period: If a
graceperiod is provided during initialization, Stoppable will wait that many milliseconds before force-closing any remaining connections.