add a timeout trying to open a random port

This commit is contained in:
Adrien Delorme 2019-05-01 12:01:34 +02:00
parent 2fd7adffc4
commit e14d1b8b0b
1 changed files with 2 additions and 0 deletions

View File

@ -7,6 +7,7 @@ import (
"math/rand" "math/rand"
"net" "net"
"strconv" "strconv"
"time"
"github.com/hashicorp/packer/common/filelock" "github.com/hashicorp/packer/common/filelock"
"github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/packer"
@ -97,5 +98,6 @@ func (lc ListenRangeConfig) Listen(ctx context.Context) (*Listener, error) {
lock: lock, lock: lock,
}, err }, err
time.Sleep(20 * time.Millisecond)
} }
} }