Skip to content

Commit

Permalink
use REUSEPORT on the main listening socket
Browse files Browse the repository at this point in the history
  • Loading branch information
c-cube committed Feb 16, 2024
1 parent 217defe commit cc560ce
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions src/Tiny_httpd_server.ml
Original file line number Diff line number Diff line change
Expand Up @@ -934,6 +934,7 @@ module Unix_tcp_server_ = struct
if should_bind then (
let inet_addr = Unix.inet_addr_of_string self.addr in
Unix.setsockopt sock Unix.SO_REUSEADDR true;
Unix.setsockopt sock Unix.SO_REUSEPORT true;
Unix.bind sock (Unix.ADDR_INET (inet_addr, self.port));
let n_listen = 2 * self.max_connections in
Unix.listen sock n_listen
Expand Down

0 comments on commit cc560ce

Please sign in to comment.