Merge pull request #4398 from mitchellh/portinclusive
step_http_server: make port range inclusive
This commit is contained in:
commit
56115ee270
|
@ -49,7 +49,8 @@ func (s *StepHTTPServer) Run(state multistep.StateBag) multistep.StepAction {
|
||||||
|
|
||||||
if portRange > 0 {
|
if portRange > 0 {
|
||||||
// Intn will panic if portRange == 0, so we do a check.
|
// Intn will panic if portRange == 0, so we do a check.
|
||||||
offset = uint(rand.Intn(portRange))
|
// Intn is from [0, n), so add 1 to make from [0, n]
|
||||||
|
offset = uint(rand.Intn(portRange + 1))
|
||||||
}
|
}
|
||||||
|
|
||||||
httpPort = offset + s.HTTPPortMin
|
httpPort = offset + s.HTTPPortMin
|
||||||
|
|
Loading…
Reference in New Issue