nervosnetwork / tentacle

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

perf: reduce time syscall #261

Closed driftluo closed 4 years ago

driftluo commented 4 years ago

It is very expensive to call the acquisition time every time a message is sent and received. At the same time, such an operation does not make any sense when the ping message exists, so I decided to remove them

TheWaWaR commented 4 years ago

Indeed, last_send_success, last_read_success exists just for timeout check is meaningless, keep_alive() already cover the functionality.

https://github.com/nervosnetwork/tentacle/blob/15abe1ef29b0683548a3eaa3681027e4332b67f0/yamux/src/session.rs#L623-L634