Commit cff3a866 authored by Brian Tiger Chow's avatar Brian Tiger Chow

refac(bitswap) privatize send block

parent 83088372
...@@ -139,7 +139,7 @@ func (bs *bitswap) HasBlock(blk blocks.Block) error { ...@@ -139,7 +139,7 @@ func (bs *bitswap) HasBlock(blk blocks.Block) error {
if ledger.WantListContains(blk.Key()) { if ledger.WantListContains(blk.Key()) {
//send block to node //send block to node
if ledger.ShouldSend() { if ledger.ShouldSend() {
bs.SendBlock(ledger.Partner, blk) bs.sendBlock(ledger.Partner, blk)
} }
} }
} }
...@@ -148,7 +148,7 @@ func (bs *bitswap) HasBlock(blk blocks.Block) error { ...@@ -148,7 +148,7 @@ func (bs *bitswap) HasBlock(blk blocks.Block) error {
} }
// TODO(brian): get a return value // TODO(brian): get a return value
func (bs *bitswap) SendBlock(p *peer.Peer, b blocks.Block) { func (bs *bitswap) sendBlock(p *peer.Peer, b blocks.Block) {
u.DOut("Sending block to peer.\n") u.DOut("Sending block to peer.\n")
message := bsmsg.New() message := bsmsg.New()
// TODO(brian): change interface to accept value instead of pointer // TODO(brian): change interface to accept value instead of pointer
...@@ -172,7 +172,7 @@ func (bs *bitswap) peerWantsBlock(p *peer.Peer, wanted u.Key) { ...@@ -172,7 +172,7 @@ func (bs *bitswap) peerWantsBlock(p *peer.Peer, wanted u.Key) {
ledger.Wants(wanted) ledger.Wants(wanted)
return return
} }
bs.SendBlock(p, *block) bs.sendBlock(p, *block)
ledger.SentBytes(numBytes(*block)) ledger.SentBytes(numBytes(*block))
} }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment