TestSocket_UNIXSocket: stop testing empty packets

OpenBSD and Solaris behave differently here.

Linux does deliver the empty packet, which is questionable
as it's undistinguishable from a closed connection.

It seems that OpenBSD and Solaris simply drop it.

We could test the platform before doing the assertion, but
it would likely be fragile, and the entire web recommend
to not ever send an empty packet, so the value of this
assertion is low.
This commit is contained in:
Jean Boussier 2023-08-31 09:23:30 +02:00 committed by Jean Boussier
parent b8e782c1b5
commit 0270210e49
Notes: git 2023-08-31 14:44:18 +00:00

View File

@ -488,9 +488,7 @@ class TestSocket_UNIXSocket < Test::Unit::TestCase
assert_kind_of(IO::WaitReadable, e)
end
s2.send("", 0)
s2.send("haha", 0)
assert_equal(nil, s1.recv(10)) # no way to distinguish empty packet from EOF with SOCK_SEQPACKET
assert_equal("haha", s1.recv(10))
assert_raise(IO::EWOULDBLOCKWaitReadable) { s1.recv_nonblock(10) }