forked from golang/net
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
internal/socket: handle reordering in TestUDP/Messages
TestUDP/Messages and TestUDP/Messages-dialed occasionally failed because the expected messages were not received in a single RecvMsgs call, or because the messages were received out of order. Assuming that both messages are returned immediately from a single RecvMsgs call was a flawed expectation. Fixed by repeatedly invoking RecvMsgs until all expected messages have been received. While it certainly seems unusual that packets are reordered on a loopback device, it does appear to happen occasionally (on linux-mips). Fixed by sizing receive buffers such that messages in any order can be received correctly, and by allowing either order for the reassembled message. Combine "Messages" and "Messages-dialed" subtests with a simple table-driven test, to avoid the repetition. The same "Message" and "Message-dialed". Finally, make the test failure messages slightly more useful. Fixes golang/go#49382
- Loading branch information
Showing
1 changed file
with
84 additions
and
104 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters