Skip to content

Commit

Permalink
Switch agent to use V2 announce endpoint (#292)
Browse files Browse the repository at this point in the history
  • Loading branch information
codygibb committed Nov 5, 2020
1 parent e435b83 commit 1e07dd7
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion lib/torrent/scheduler/announcer/announcer.go
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ func Default(
func (a *Announcer) Announce(
d core.Digest, h core.InfoHash, complete bool) ([]*core.PeerInfo, error) {

peers, interval, err := a.client.Announce(d, h, complete, announceclient.V1)
peers, interval, err := a.client.Announce(d, h, complete, announceclient.V2)
if err != nil {
return nil, err
}
Expand Down
4 changes: 2 additions & 2 deletions lib/torrent/scheduler/announcer/announcer_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ func TestAnnouncerAnnounceUpdatesInterval(t *testing.T) {
interval := 10 * time.Second
peers := []*core.PeerInfo{core.PeerInfoFixture()}

mocks.client.EXPECT().Announce(d, hash, false, announceclient.V1).Return(peers, interval, nil)
mocks.client.EXPECT().Announce(d, hash, false, announceclient.V2).Return(peers, interval, nil)

result, err := announcer.Announce(d, hash, false)
require.NoError(err)
Expand Down Expand Up @@ -129,7 +129,7 @@ func TestAnnouncerAnnounceErr(t *testing.T) {
hash := core.InfoHashFixture()
err := errors.New("some error")

mocks.client.EXPECT().Announce(d, hash, false, announceclient.V1).Return(nil, time.Duration(0), err)
mocks.client.EXPECT().Announce(d, hash, false, announceclient.V2).Return(nil, time.Duration(0), err)

_, aErr := announcer.Announce(d, hash, false)
require.Equal(err, aErr)
Expand Down
6 changes: 3 additions & 3 deletions lib/torrent/scheduler/events_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ func TestAnnounceTickEvent(t *testing.T) {
ctrls[0].dispatcher.Digest(),
ctrls[0].dispatcher.InfoHash(),
false,
announceclient.V1).
announceclient.V2).
Return(nil, time.Second, nil)

announceTickEvent{}.apply(state)
Expand Down Expand Up @@ -187,7 +187,7 @@ func TestAnnounceTickEventSkipsFullTorrents(t *testing.T) {
empty.dispatcher.Digest(),
empty.dispatcher.InfoHash(),
false,
announceclient.V1).
announceclient.V2).
Return(nil, time.Second, nil)

announceTickEvent{}.apply(state)
Expand Down Expand Up @@ -219,7 +219,7 @@ func TestAnnounceTickEventSkipsFullTorrents(t *testing.T) {
full.dispatcher.Digest(),
full.dispatcher.InfoHash(),
false,
announceclient.V1).
announceclient.V2).
Return(nil, time.Second, nil)

announceTickEvent{}.apply(state)
Expand Down

0 comments on commit 1e07dd7

Please sign in to comment.