Skip to content

Commit

Permalink
Account for stack differences in the socketpair test (issue #312)
Browse files Browse the repository at this point in the history
Linux returns ECONNRESET while every other stack tested returns EOF on this
test.

I did not dig into the especification but Linux appears to be on the weird side.

In order to get a ECONNRESET, the write needs to hit the socket _after_ the
close, but our program does:

WRITE(A)
CLOSE(B)
READ(A)

Linux never gives "A" side a chance to see a proper EOF, while the others do:

Linux        -> ECONNRESET
FreeBSD 12   -> EOF
OpenBSD 7.2  -> EOF
macos 12.5.1 -> EOF

Until we can reliably guarantee the same return on all stacks, relax the test a
bit and accept EOF.
  • Loading branch information
haesbaert committed Sep 17, 2022
1 parent 5be0ec4 commit c4887ec
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion tests/network.md
Original file line number Diff line number Diff line change
Expand Up @@ -450,7 +450,7 @@ ECONNRESET:
try
ignore (Eio.Flow.read a (Cstruct.create 1) : int);
assert false
with Eio.Net.Connection_reset _ -> traceln "Connection failed (good)";;
with Eio.Net.Connection_reset _ | End_of_file -> traceln "Connection failed (good)";;
+Connection failed (good)
- : unit = ()
```
Expand Down

0 comments on commit c4887ec

Please sign in to comment.