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

fix(bitswap) compiler errors

didn't run tests after the refactor. apologies.
parent f6e8d958
...@@ -4,7 +4,7 @@ import ( ...@@ -4,7 +4,7 @@ import (
"testing" "testing"
context "github.com/jbenet/go-ipfs/Godeps/_workspace/src/code.google.com/p/go.net/context" context "github.com/jbenet/go-ipfs/Godeps/_workspace/src/code.google.com/p/go.net/context"
bsmsg "github.com/jbenet/go-ipfs/bitswap/message" bsmsg "github.com/jbenet/go-ipfs/exchange/bitswap/message"
peer "github.com/jbenet/go-ipfs/peer" peer "github.com/jbenet/go-ipfs/peer"
) )
......
...@@ -3,20 +3,20 @@ package strategy ...@@ -3,20 +3,20 @@ package strategy
import ( import (
"testing" "testing"
message "github.com/jbenet/go-ipfs/bitswap/message" message "github.com/jbenet/go-ipfs/exchange/bitswap/message"
"github.com/jbenet/go-ipfs/peer" "github.com/jbenet/go-ipfs/peer"
"github.com/jbenet/go-ipfs/util/testutil" "github.com/jbenet/go-ipfs/util/testutil"
) )
type peerAndStrategist struct { type peerAndStrategist struct {
*peer.Peer *peer.Peer
Strategist Strategy
} }
func newPeerAndStrategist(idStr string) peerAndStrategist { func newPeerAndStrategist(idStr string) peerAndStrategist {
return peerAndStrategist{ return peerAndStrategist{
Peer: &peer.Peer{ID: peer.ID(idStr)}, Peer: &peer.Peer{ID: peer.ID(idStr)},
Strategist: New(), Strategy: New(),
} }
} }
...@@ -32,7 +32,7 @@ func TestBlockRecordedAsWantedAfterMessageReceived(t *testing.T) { ...@@ -32,7 +32,7 @@ func TestBlockRecordedAsWantedAfterMessageReceived(t *testing.T) {
chooser.MessageReceived(beggar.Peer, messageFromBeggarToChooser) chooser.MessageReceived(beggar.Peer, messageFromBeggarToChooser)
// for this test, doesn't matter if you record that beggar sent // for this test, doesn't matter if you record that beggar sent
if !chooser.IsWantedByPeer(block.Key(), beggar.Peer) { if !chooser.BlockIsWantedByPeer(block.Key(), beggar.Peer) {
t.Fatal("chooser failed to record that beggar wants block") t.Fatal("chooser failed to record that beggar wants block")
} }
} }
...@@ -51,16 +51,16 @@ func TestPeerIsAddedToPeersWhenMessageReceivedOrSent(t *testing.T) { ...@@ -51,16 +51,16 @@ func TestPeerIsAddedToPeersWhenMessageReceivedOrSent(t *testing.T) {
t.Fatal("Sanity Check: Peers have same Key!") t.Fatal("Sanity Check: Peers have same Key!")
} }
if !peerIsPartner(seattle.Peer, sanfrancisco.Strategist) { if !peerIsPartner(seattle.Peer, sanfrancisco.Strategy) {
t.Fatal("Peer wasn't added as a Partner") t.Fatal("Peer wasn't added as a Partner")
} }
if !peerIsPartner(sanfrancisco.Peer, seattle.Strategist) { if !peerIsPartner(sanfrancisco.Peer, seattle.Strategy) {
t.Fatal("Peer wasn't added as a Partner") t.Fatal("Peer wasn't added as a Partner")
} }
} }
func peerIsPartner(p *peer.Peer, s Strategist) bool { func peerIsPartner(p *peer.Peer, s Strategy) bool {
for _, partner := range s.Peers() { for _, partner := range s.Peers() {
if partner.Key() == p.Key() { if partner.Key() == p.Key() {
return true return true
......
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