Skip to content
This repository has been archived by the owner on Feb 1, 2023. It is now read-only.

Refactor: simplify session peer management #275

Merged
merged 6 commits into from
Mar 6, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 2 additions & 2 deletions bitswap.go
Original file line number Diff line number Diff line change
Expand Up @@ -148,10 +148,10 @@ func New(parent context.Context, network bsnet.BitSwapNetwork,
provSearchDelay time.Duration,
rebroadcastDelay delay.D,
self peer.ID) bssm.Session {
return bssession.New(ctx, id, wm, spm, sim, pm, bpm, notif, provSearchDelay, rebroadcastDelay, self)
return bssession.New(ctx, id, wm, spm, pqm, sim, pm, bpm, notif, provSearchDelay, rebroadcastDelay, self)
}
sessionPeerManagerFactory := func(ctx context.Context, id uint64) bssession.SessionPeerManager {
return bsspm.New(ctx, id, network.ConnectionManager(), pqm)
return bsspm.New(id, network.ConnectionManager())
}
notif := notifications.New()
sm := bssm.New(ctx, sessionFactory, sim, sessionPeerManagerFactory, bpm, pm, notif, network.Self())
Expand Down
12 changes: 6 additions & 6 deletions internal/messagequeue/messagequeue_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -394,9 +394,9 @@ func TestWantlistRebroadcast(t *testing.T) {
t.Fatal("wrong number of wants")
}

// Tell message queue to rebroadcast after 5ms, then wait 8ms
messageQueue.SetRebroadcastInterval(5 * time.Millisecond)
messages = collectMessages(ctx, t, messagesSent, 8*time.Millisecond)
// Tell message queue to rebroadcast after 10ms, then wait 15ms
messageQueue.SetRebroadcastInterval(10 * time.Millisecond)
messages = collectMessages(ctx, t, messagesSent, 15*time.Millisecond)
firstMessage = messages[0]

// Both original and new wants should have been rebroadcast
Expand Down Expand Up @@ -425,9 +425,9 @@ func TestWantlistRebroadcast(t *testing.T) {
}
}

// Tell message queue to rebroadcast after 5ms, then wait 8ms
messageQueue.SetRebroadcastInterval(5 * time.Millisecond)
messages = collectMessages(ctx, t, messagesSent, 8*time.Millisecond)
// Tell message queue to rebroadcast after 10ms, then wait 15ms
messageQueue.SetRebroadcastInterval(10 * time.Millisecond)
messages = collectMessages(ctx, t, messagesSent, 15*time.Millisecond)
firstMessage = messages[0]
if len(firstMessage.Wantlist()) != totalWants-len(cancels) {
t.Fatal("did not rebroadcast all wants")
Expand Down
57 changes: 0 additions & 57 deletions internal/session/peeravailabilitymanager.go

This file was deleted.

74 changes: 0 additions & 74 deletions internal/session/peeravailabilitymanager_test.go

This file was deleted.