Tokio Listen Helpers

Status: Beta

Documentation | Github | Crate

A library that allows to listen network sockets with proper resource limits and error handling.

Basic challenges:

Example

Here is the basic example:

```rust

let TIMETO WAITONERROR = Duration::frommillis(100); let MAXSIMULTANEOUSCONNECTIONS = 1000;

let mut lp = Core::new().unwrap(); let listener = TcpListener::bind(&addr, &lp.handle()).unwrap(); lp.run( listener.incoming() .sleeponerror(TIMETOWAITONERROR, &h2) .map(move |(mut socket, addr)| { // Your future is here: Proto::new(socket) // Errors should not pass silently // common idea is to log them .maperr(|e| error!("Protocol error: {}", e)) }) .listen(MAXSIMULTANEOUSCONNECTIONS) ).unwrap(); // stream doesn't end in this case ```

More in [docs] and [examples]

License

Licensed under either of

Contribution

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.