Fix small cache transfer tests
Since hashing Peer Addrs in the Torrent pending peers, clients are getting more than one connection to the seeder in the tests and failing.
This commit is contained in:
parent
c2210c058c
commit
e5f7765dfa
@ -612,7 +612,7 @@ func TestSetMaxEstablishedConn(t *testing.T) {
|
||||
ih := testutil.GreetingMetaInfo().HashInfoBytes()
|
||||
cfg := TestingConfig()
|
||||
cfg.DisableAcceptRateLimiting = true
|
||||
cfg.dropDuplicatePeerIds = true
|
||||
cfg.DropDuplicatePeerIds = true
|
||||
for i := range iter.N(3) {
|
||||
cl, err := NewClient(cfg)
|
||||
require.NoError(t, err)
|
||||
|
@ -120,7 +120,7 @@ type ClientConfig struct {
|
||||
DisableAcceptRateLimiting bool
|
||||
// Don't add connections that have the same peer ID as an existing
|
||||
// connection for a given Torrent.
|
||||
dropDuplicatePeerIds bool
|
||||
DropDuplicatePeerIds bool
|
||||
|
||||
ConnTracker *conntrack.Instance
|
||||
|
||||
|
@ -217,6 +217,15 @@ func testClientTransferSmallCache(t *testing.T, setReadahead bool, readahead int
|
||||
// thought we had.
|
||||
Readahead: readahead,
|
||||
ExportClientStatus: true,
|
||||
|
||||
// These tests don't work well with more than 1 connection to the seeder.
|
||||
ConfigureLeecher: ConfigureClient{
|
||||
Config: func(cfg *torrent.ClientConfig) {
|
||||
cfg.DropDuplicatePeerIds = true
|
||||
//cfg.DisableIPv6 = true
|
||||
//cfg.DisableUTP = true
|
||||
},
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
|
@ -1560,7 +1560,7 @@ func (t *Torrent) addConnection(c *PeerConn) (err error) {
|
||||
if c.PeerID != c0.PeerID {
|
||||
continue
|
||||
}
|
||||
if !t.cl.config.dropDuplicatePeerIds {
|
||||
if !t.cl.config.DropDuplicatePeerIds {
|
||||
continue
|
||||
}
|
||||
if left, ok := c.hasPreferredNetworkOver(c0); ok && left {
|
||||
|
Loading…
x
Reference in New Issue
Block a user