nervosnetwork / tentacle

A multiplexed p2p network framework that supports custom protocols
https://docs.rs/tentacle
MIT License
54 stars 24 forks source link

fix: add transport connection number limit on listener #200

Closed driftluo closed 4 years ago

driftluo commented 4 years ago

Tentacle has not previously made any restrictions on the number of transport connections, which may lead to fd attacks. The good news is that the consequence of the fd attack is only that the listening service will be closed, and it will not affect the established connection. But we should fix it.

The fd create on std::sys::net, and it will call by tokio::tcplistener::poll_accpet, their calling relationship is as follows:

tokio -> mio -> std net -> std sys common -> std sys net -> std sys fd -> syscall