willardf / Hazel-Networking

Hazel Networking is a low level networking library for C# providing connection-oriented, message-based communication via RUDP.
MIT License
391 stars 60 forks source link

Improve MaxCertFragmentSize calculation and test for fragmented cert packet reordering issues #44

Closed willardf closed 2 years ago

willardf commented 2 years ago

Might need some extra thought on the tests. The problem is that the SocketCapture was grabbing a packet before waiting. Then it would implicitly discard that packet via wait time. If a packet is not in the queue, it's really hard to reorder the queue, so I made us wait, then grab a packet. I also wanted to make discarding packets explicit instead of timed, but packet arrival is very time-sensitive, so it's hard to assert that things are truly happening the way they should.

Mukikaizoku commented 2 years ago

Hmmm yeah, noted on the reordering... especially without changing too much of the testing code - thoughts might be to just use a list and lock it (perf issues shouldn't be an issue here I think) or if we did keep time values, possibly set a delay after popping it off the queue? I'm thinking more abstractly here as these tests are pretty thick - I might be far off