mirror of
https://github.com/ipfs/kubo.git
synced 2025-06-30 18:13:54 +08:00
refactor(bitswap) rm SetStrategy method
remove this setter while the interface is under construction
This commit is contained in:
@ -78,6 +78,7 @@ func NewSession(parent context.Context, p *peer.Peer, d ds.Datastore, r routing.
|
|||||||
sender: sender,
|
sender: sender,
|
||||||
haltChan: make(chan struct{}),
|
haltChan: make(chan struct{}),
|
||||||
notifications: notifications.New(),
|
notifications: notifications.New(),
|
||||||
|
strategy: YesManStrategy,
|
||||||
}
|
}
|
||||||
receiver.Delegate(bs)
|
receiver.Delegate(bs)
|
||||||
|
|
||||||
@ -242,13 +243,6 @@ func (bs *BitSwap) Halt() {
|
|||||||
bs.haltChan <- struct{}{}
|
bs.haltChan <- struct{}{}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (bs *BitSwap) SetStrategy(sf StrategyFunc) {
|
|
||||||
bs.strategy = sf
|
|
||||||
for _, ledger := range bs.partners {
|
|
||||||
ledger.Strategy = sf
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
func (bs *BitSwap) ReceiveMessage(
|
func (bs *BitSwap) ReceiveMessage(
|
||||||
ctx context.Context, sender *peer.Peer, incoming bsmsg.BitSwapMessage) (
|
ctx context.Context, sender *peer.Peer, incoming bsmsg.BitSwapMessage) (
|
||||||
bsmsg.BitSwapMessage, *peer.Peer, error) {
|
bsmsg.BitSwapMessage, *peer.Peer, error) {
|
||||||
|
@ -109,7 +109,6 @@ func NewIpfsNode(cfg *config.Config, online bool) (*IpfsNode, error) {
|
|||||||
|
|
||||||
// TODO(brian): pass a context to bs for its async operations
|
// TODO(brian): pass a context to bs for its async operations
|
||||||
bitswapSession := bitswap.NewSession(context.TODO(), local, d, route)
|
bitswapSession := bitswap.NewSession(context.TODO(), local, d, route)
|
||||||
bitswapSession.SetStrategy(bitswap.YesManStrategy)
|
|
||||||
|
|
||||||
// TODO(brian): pass a context to initConnections
|
// TODO(brian): pass a context to initConnections
|
||||||
go initConnections(cfg, route)
|
go initConnections(cfg, route)
|
||||||
|
Reference in New Issue
Block a user