Allow port 0

bug/bundler_fix
Lutz Wolf 2014-05-24 23:44:50 +02:00
parent 66252ba9e5
commit 4fc6e402dc
1 changed files with 3 additions and 3 deletions

View File

@ -538,11 +538,11 @@ module Socket
end end
if ports.empty? and not remove.empty? then if ports.empty? and not remove.empty? then
ports = 1.upto 65535 ports = 0.upto 65535
end end
# Sort, and remove dups and invalid ports # Sort, and remove dups and invalid ports
ports.sort.uniq.delete_if { |p| p < 1 or p > 65535 or remove.include? p } ports.sort.uniq.delete_if { |p| p < 0 or p > 65535 or remove.include? p }
end end
# #
@ -555,7 +555,7 @@ module Socket
lastp = nil lastp = nil
parr.uniq.sort{|a,b| a<=>b}.map{|a| a.to_i}.each do |n| parr.uniq.sort{|a,b| a<=>b}.map{|a| a.to_i}.each do |n|
next if (n < 1 or n > 65535) next if (n < 0 or n > 65535)
if not lastp if not lastp
range = [n] range = [n]
lastp = n lastp = n