Skip to content

Commit

Permalink
luv: perhaps we should always call Unix.setsockopt when fd is available
Browse files Browse the repository at this point in the history
  • Loading branch information
bikallem committed Nov 4, 2022
1 parent 1ecc270 commit 7522fb4
Showing 1 changed file with 6 additions and 10 deletions.
16 changes: 6 additions & 10 deletions lib_eio_luv/eio_luv.ml
Original file line number Diff line number Diff line change
Expand Up @@ -748,18 +748,14 @@ class virtual ['a] listening_socket ~backlog sock = object (self)
end

let luv_reuse_addr sock v =
if v then (
match Handle.to_unix_opt `Peek sock with
| Some fd -> Unix.setsockopt fd Unix.SO_REUSEADDR true
| None -> ()
)
match Handle.to_unix_opt `Peek sock with
| Some fd -> Unix.setsockopt fd Unix.SO_REUSEADDR v
| None -> ()

let luv_reuse_port sock v =
if v then (
match Handle.to_unix_opt `Peek sock with
| Some fd -> Unix.setsockopt fd Unix.SO_REUSEPORT true
| None -> ()
)
match Handle.to_unix_opt `Peek sock with
| Some fd -> Unix.setsockopt fd Unix.SO_REUSEPORT v
| None -> ()

let luv_addr_of_eio host port =
let host = Unix.string_of_inet_addr (Eio_unix.Ipaddr.to_unix host) in
Expand Down

0 comments on commit 7522fb4

Please sign in to comment.