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

Commit

Permalink
refactor: clean up peermanager
Browse files Browse the repository at this point in the history
  • Loading branch information
dirkmc committed Sep 11, 2019
1 parent 81ea0c6 commit e7c6084
Showing 1 changed file with 0 additions and 24 deletions.
24 changes: 0 additions & 24 deletions peermanager/peermanager.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,6 @@ import (
"context"
"sync"

// bsmsg "github.com/ipfs/go-bitswap/message"
// wantlist "github.com/ipfs/go-bitswap/wantlist"

cid "github.com/ipfs/go-cid"
logging "github.com/ipfs/go-log"
peer "github.com/libp2p/go-libp2p-core/peer"
Expand All @@ -16,12 +13,10 @@ var log = logging.Logger("bs:pmgr")

// PeerQueue provides a queue of messages to be sent for a single peer.
type PeerQueue interface {
// AddMessage(entries []bsmsg.Entry, ses uint64)
AddBroadcastWantHaves([]cid.Cid)
AddWants([]cid.Cid, []cid.Cid)
AddCancels([]cid.Cid)
Startup()
// AddWantlist(initialWants *wantlist.SessionTrackedWantlist)
Shutdown()
}

Expand Down Expand Up @@ -83,7 +78,6 @@ func (pm *PeerManager) Connected(p peer.ID, initialWantHaves []cid.Cid) {

if pq.refcnt == 0 {
// Broadcast any live want-haves to the newly connected peers
// pq.pq.AddWantlist(initialWants)
pq.pq.AddBroadcastWantHaves(initialWantHaves)
}

Expand Down Expand Up @@ -142,24 +136,6 @@ func (pm *PeerManager) SendCancels(ctx context.Context, cancelKs []cid.Cid) {
}
}

// SendMessage is called to send a message to all or some peers in the pool;
// if targets is nil, it sends to all.
// func (pm *PeerManager) SendMessage(entries []bsmsg.Entry, targets []peer.ID, from uint64) {
// pm.Lock()
// defer pm.UnLock()

// if len(targets) == 0 {
// for _, p := range pm.peerQueues {
// p.pq.AddMessage(entries, from)
// }
// } else {
// for _, t := range targets {
// pqi := pm.getOrCreate(t)
// pqi.pq.AddMessage(entries, from)
// }
// }
// }

func (pm *PeerManager) PeerCanSendWants(p peer.ID, wants []cid.Cid) []cid.Cid {
pm.RLock()
defer pm.RUnlock()
Expand Down

0 comments on commit e7c6084

Please sign in to comment.