Skip to content

Commit

Permalink
Fix test_reuseport
Browse files Browse the repository at this point in the history
  • Loading branch information
byroot committed Aug 20, 2024
1 parent 6ce6b5f commit 595bf7c
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion test/unit/test_socket_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -193,14 +193,15 @@ def test_ipv6only
end

def test_reuseport
skip("Missing Socket::SO_REUSEPORT") unless defined?(TCP_DEFER_ACCEPT)
skip("Missing Socket::SO_REUSEPORT") unless defined?(Socket::SO_REUSEPORT)

port = unused_port @test_addr
name = "#@test_addr:#{port}"
sock = bind_listen(name, :reuseport => true)
cur = sock.getsockopt(:SOL_SOCKET, :SO_REUSEPORT).int
assert_operator cur, :>, 0
rescue Errno::ENOPROTOOPT
skip("Missing SO_REUSEPORT")
# kernel does not support SO_REUSEPORT (older Linux)
end
end

0 comments on commit 595bf7c

Please sign in to comment.