LCOV - code coverage report | ||||||||||||||||||||||
|
||||||||||||||||||||||
Line data Source code 1 : use std::{ 2 : io, 3 : net::{TcpListener, ToSocketAddrs}, 4 : }; 5 : 6 : use nix::sys::socket::{setsockopt, sockopt::ReuseAddr}; 7 : 8 : /// Bind a [`TcpListener`] to addr with `SO_REUSEADDR` set to true. 9 0 : pub fn bind<A: ToSocketAddrs>(addr: A) -> io::Result<TcpListener> { 10 0 : let listener = TcpListener::bind(addr)?; 11 : 12 0 : setsockopt(&listener, ReuseAddr, &true)?; 13 : 14 0 : Ok(listener) 15 0 : } |
Generated by: LCOV version 2.1-beta |