Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions spec/inputs/tcp_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,10 @@

def get_port
begin
# Start high to better avoid common services
port = rand(10000..65535)
# Start high to better avoid common services, but stay below the OS ephemeral port
# ranges (Linux: 32768-60999, macOS: 49152-65535) so that the kernel cannot hand
# the port out to another socket between this check and the plugin binding to it.
port = rand(10000..32767)
s = TCPServer.new("127.0.0.1", port)
s.close
return port
Expand Down
Loading