From 958ff01eab644c303b42ea5259e0523e0533d343 Mon Sep 17 00:00:00 2001
From: Matt Joiner <anacrolix@gmail.com>
Date: Fri, 19 Jul 2019 16:19:21 +1000
Subject: [PATCH] Change the default client port

---
 client_test.go       | 1 +
 config.go            | 1 +
 fs/torrentfs_test.go | 1 +
 3 files changed, 3 insertions(+)

diff --git a/client_test.go b/client_test.go
index a1db9db0..e0854867 100644
--- a/client_test.go
+++ b/client_test.go
@@ -36,6 +36,7 @@ func TestingConfig() *ClientConfig {
 	cfg.DisableTrackers = true
 	cfg.NoDefaultPortForwarding = true
 	cfg.DisableAcceptRateLimiting = true
+	cfg.ListenPort = 0
 	return cfg
 }
 
diff --git a/config.go b/config.go
index 5582456a..f4c190fb 100644
--- a/config.go
+++ b/config.go
@@ -164,6 +164,7 @@ func NewDefaultClientConfig() *ClientConfig {
 		},
 		CryptoSelector: mse.DefaultCryptoSelector,
 		CryptoProvides: mse.AllSupportedCrypto,
+		ListenPort:     42069,
 	}
 	cc.ConnTracker.SetNoMaxEntries()
 	cc.ConnTracker.Timeout = func(conntrack.Entry) time.Duration { return 0 }
diff --git a/fs/torrentfs_test.go b/fs/torrentfs_test.go
index 4a37a351..582f9c2d 100644
--- a/fs/torrentfs_test.go
+++ b/fs/torrentfs_test.go
@@ -189,6 +189,7 @@ func TestDownloadOnDemand(t *testing.T) {
 	cfg.DisableTCP = true
 	cfg.DefaultStorage = storage.NewMMap(filepath.Join(layout.BaseDir, "download"))
 	cfg.ListenHost = torrent.LoopbackListenHost
+	cfg.ListenPort = 0
 	leecher, err := torrent.NewClient(cfg)
 	require.NoError(t, err)
 	testutil.ExportStatusWriter(leecher, "l")()
-- 
2.51.0