LCOV - code coverage report
Current view: top level - libs/utils/src - tcp_listener.rs (source / functions) Coverage Total Hit
Test: 53437f7e869ac68c86c7d3e4c20964c0156f158c.info Lines: 0.0 % 5 0
Test Date: 2024-09-20 16:14:12 Functions: 0.0 % 4 0

            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