quinn-rs / quinn

Async-friendly QUIC implementation in Rust
Apache License 2.0
3.76k stars 380 forks source link

max_datagram_size() seems to be off by 2 #1412

Closed jfro closed 1 year ago

jfro commented 2 years ago

Not sure if this should just be documented or if there should be a fix to the calculation. If I try to send a packet via send_datagram of data at the size returned by max_datagram_size() I'll get a Toolarge error. I've had to reduce it by 2 to get it to pass the check & send the datagram. I'm calling max_datagram_size() at time of data generation & immediate send_datagram() call so it should be current.

Ralith commented 2 years ago

Thanks for the report! We should really have a unit test for this.

Ralith commented 2 years ago

I'm not able to reproduce this on 0.8 or main. Can you provide a repro?

jfro commented 2 years ago

I'll try, but my first attempt at a repro for the assertion bug didn't yield the same problem the original code producing this issue is, haven't found what the difference between the 2 is so far.

terrarier2111 commented 1 year ago

I had a similar issue where when i sent a packet with a size of max_datagram_size it wouldn't reach its destination, but when subtracting 1 or more from it, it worked

Ralith commented 1 year ago

That was https://github.com/quinn-rs/quinn/issues/1413, which was fixed in https://github.com/quinn-rs/quinn/pull/1415.

Ralith commented 1 year ago

Closing as not reproducible.