sozu icon indicating copy to clipboard operation
sozu copied to clipboard

Redundant code in the accept client loop

Open Wonshtrum opened this issue 3 years ago • 0 comments

The accept client loop of the main process differs depending on whether the process is the original (it was launched with "start") or was upgraded. For the original main process, command::start_server leads to this block of code which is responsible for accepting new clients. https://github.com/sozu-proxy/sozu/blob/ca8fd82cb9c4a67254b0b562161242dac799851c/bin/src/command/mod.rs#L417-L459 Whereas for subsequent main processes, started through upgrade, upgrade::begin_new_main_process leads to this other block of code which is functionally equivalent. https://github.com/sozu-proxy/sozu/blob/ca8fd82cb9c4a67254b0b562161242dac799851c/bin/src/command/mod.rs#L868-L912 The only noticeable differences are:

  • the "Accepted a client from upgraded" debug log in the upgraded main
  • the client id format: CL-{counter} for the original and CL-up-{counter} for the upgraded (which has no further consequences)

We may want to fuse this logic.

Wonshtrum avatar Sep 06 '22 13:09 Wonshtrum