LCOV - code coverage report
Current view: top level - libs/utils/src - tcp_listener.rs (source / functions) Coverage Total Hit
Test: a2f0f8a80fbf1089336086fa360ce27fa555cb1a.info Lines: 0.0 % 5 0
Test Date: 2024-11-20 17:59:39 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