nervosnetwork / tentacle

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

fix: fix some msg left on buffer #288

Closed driftluo closed 3 years ago

driftluo commented 3 years ago
  1. sink start_send just set data to buffer, flush will try to write data to inner io
  2. Remove write buffer on yamux stream, it will cause context confusion, and let the data be copied once more
  3. yamux stream read must break on having read something
  4. yamux control message send by unbound channel
  5. secio after confirming that it can be sent, encrypt the data

codec write buffer left:

https://github.com/nervosnetwork/tentacle/blob/fix-message-delay/tentacle/src/substream.rs#L427

yamux read buffer left:

https://github.com/nervosnetwork/tentacle/blob/fix-message-delay/yamux/src/stream.rs#L302

driftluo commented 3 years ago

Add some test cases?

There have been tests, and occasionally failed, but did not pay attention to it, thought it was a problem caused by poor ci machine