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