mirror of
https://github.com/fluencelabs/redis
synced 2025-03-17 16:10:50 +00:00
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:
parent
612bc784fc
commit
54157bc49e
@ -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} {
|
||||
|
Loading…
x
Reference in New Issue
Block a user