lntest: lower initial port, add ApplyPortOffset function
To allow running multiple test tranches in parallel, we need a way to make sure the TCP ports don't collide. We'll work with offsets for the ports, using a different offset for each tranche.
This commit is contained in:
parent
fbb430ad82
commit
a50d337e42
@ -43,7 +43,7 @@ const (
|
||||
// defaultNodePort is the start of the range for listening ports of
|
||||
// harness nodes. Ports are monotonically increasing starting from this
|
||||
// number and are determined by the results of nextAvailablePort().
|
||||
defaultNodePort = 19555
|
||||
defaultNodePort = 5555
|
||||
|
||||
// logPubKeyBytes is the number of bytes of the node's PubKey that will
|
||||
// be appended to the log file name. The whole PubKey is too long and
|
||||
@ -104,6 +104,12 @@ func nextAvailablePort() int {
|
||||
panic("no ports available for listening")
|
||||
}
|
||||
|
||||
// ApplyPortOffset adds the given offset to the lastPort variable, making it
|
||||
// possible to run the tests in parallel without colliding on the same ports.
|
||||
func ApplyPortOffset(offset uint32) {
|
||||
_ = atomic.AddUint32(&lastPort, offset)
|
||||
}
|
||||
|
||||
// generateListeningPorts returns four ints representing ports to listen on
|
||||
// designated for the current lightning network test. This returns the next
|
||||
// available ports for the p2p, rpc, rest and profiling services.
|
||||
|
Loading…
Reference in New Issue
Block a user