Commit Graph

16 Commits

Author SHA1 Message Date
Radek Simko 8519da6ce9
common/net: Cleanup cache of used port after closing 2019-05-06 22:11:52 +01:00
Adrien Delorme b329073e54 remove trying port log as retry code will show errors
less logs !
2019-05-01 13:04:51 +02:00
Adrien Delorme 38f789eedc add error types to test for 2019-05-01 13:01:25 +02:00
Adrien Delorme 14f2d1c132 ListenRangeConfig:Listen: use the retry pkg to wait a bit in between opens 2019-05-01 12:27:32 +02:00
Adrien Delorme e14d1b8b0b add a timeout trying to open a random port 2019-05-01 12:01:34 +02:00
Adrien Delorme 2fd7adffc4 add tests for ListenRangeConfig.Listen 2019-05-01 11:46:48 +02:00
Adrien Delorme d9e5145de9 Shadow the flock pkg & add a noop filelock so that at least the solaris binary can be built
Without this the following error occurs:

$ GOOS=solaris go build .
# github.com/hashicorp/packer/vendor/github.com/gofrs/flock
vendor/github.com/gofrs/flock/flock_unix.go:28:22: undefined: syscall.LOCK_EX
vendor/github.com/gofrs/flock/flock_unix.go:39:22: undefined: syscall.LOCK_SH
vendor/github.com/gofrs/flock/flock_unix.go:56:12: undefined: syscall.Flock
vendor/github.com/gofrs/flock/flock_unix.go:66:12: undefined: syscall.Flock
vendor/github.com/gofrs/flock/flock_unix.go:96:12: undefined: syscall.Flock
vendor/github.com/gofrs/flock/flock_unix.go:96:42: undefined: syscall.LOCK_UN
vendor/github.com/gofrs/flock/flock_unix.go:118:21: undefined: syscall.LOCK_EX
vendor/github.com/gofrs/flock/flock_unix.go:130:21: undefined: syscall.LOCK_SH
vendor/github.com/gofrs/flock/flock_unix.go:149:9: undefined: syscall.Flock
vendor/github.com/gofrs/flock/flock_unix.go:149:44: undefined: syscall.LOCK_NB
vendor/github.com/gofrs/flock/flock_unix.go:149:44: too many errors
2019-04-30 16:01:23 +02:00
Adrien Delorme 5d9d43c01d add tests for ListenRangeConfig.Listen 2019-04-30 15:42:59 +02:00
Adrien Delorme fd63ec9a6c ListenRangeConfig.Listen: move trying port log after fslock trylock for less logs 2019-04-30 15:35:22 +02:00
Adrien Delorme 79ae62801f ListenRangeConfig: default network ( protocol ) to tcp 2019-04-30 14:55:38 +02:00
Adrien Delorme 91cc7e1091 net.ListenRangeConfig.Listen: don't swap ports if max < min 2019-03-26 10:53:52 +01:00
Adrien Delorme a4a83be2b9 net.ListenRangeConfig.Listen: allow to have a port rage of zero 2019-03-26 10:52:07 +01:00
Adrien Delorme cd39aa9988 net.ListenRangeConfig.Listen: log tried ports a bit earlier in the process
so we know tried ports every time
2019-03-26 10:45:32 +01:00
Adrien Delorme 5a6dffde9a use port as ints 2019-03-19 15:01:12 +01:00
Adrien Delorme c214f6735b make everything a uint 2019-03-19 12:54:15 +01:00
Adrien Delorme 1685a1c4c0 add common/net package that can listen on a random port in a range 2019-03-19 12:53:56 +01:00