]> Sergey Matveev's repositories - btrtrc.git/commitdiff
NewClient nil ClientConfig should use dynamic port
authorMatt Joiner <anacrolix@gmail.com>
Tue, 30 Jul 2019 07:19:14 +0000 (17:19 +1000)
committerMatt Joiner <anacrolix@gmail.com>
Tue, 30 Jul 2019 07:19:14 +0000 (17:19 +1000)
It's pretty hard to test otherwise, if something's already on the default port.

client.go

index db0fae1889084549ddc05dcace5100bf6e97629c..c6801cf10740037ef5ac7c0cbfd61cff2371a4ae 100644 (file)
--- a/client.go
+++ b/client.go
@@ -173,6 +173,7 @@ func (cl *Client) announceKey() int32 {
 func NewClient(cfg *ClientConfig) (cl *Client, err error) {
        if cfg == nil {
                cfg = NewDefaultClientConfig()
+               cfg.ListenPort = 0
        }
        defer func() {
                if err != nil {