Test: find_available_port: check that cluster port is free as well.

The function will only return ports that have also port+10000 free, so
that Redis Cluster instances can be executed at the returned port.
This commit is contained in:
antirez 2014-06-30 12:07:26 +02:00
parent 612bc784fc
commit 54157bc49e

View File

@ -315,12 +315,14 @@ proc roundFloat f {
proc find_available_port start {
for {set j $start} {$j < $start+1024} {incr j} {
if {[catch {
set fd [socket 127.0.0.1 $j]
}]} {
if {[catch {set fd1 [socket 127.0.0.1 $j]}] &&
[catch {set fd2 [socket 127.0.0.1 [expr $j+10000]]}]} {
return $j
} else {
close $fd
catch {
close $fd1
close $fd2
}
}
}
if {$j == $start+1024} {