romange / helio

A modern framework for backend development based on io_uring Linux interface
Apache License 2.0
435 stars 49 forks source link

feat: allow a listener to stop accepting new connections #249

Closed romange closed 5 months ago

romange commented 5 months ago

There are two ways to stop accepting:

  1. stop pulling a connection from the accept queue. This leads to a back pressure on a client side
  2. Pull and immediately close. This usually leads to retries on the client side

This PR implements the second option, which seems like a bad idea, but in some cases is necessary. For example, when we failover to a differrent host, we want a client to retry until its DNS cache is updated with the new host ip and it reconnects to a differrent node. This mode essentially simulates the behavior of a closed port.