Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
dms3
go-bitswap
Commits
ff4b979d
Commit
ff4b979d
authored
Sep 18, 2014
by
Brian Tiger Chow
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix(bitswap) compiler errors
didn't run tests after the refactor. apologies.
parent
f6e8d958
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
9 additions
and
9 deletions
+9
-9
network/forwarder_test.go
network/forwarder_test.go
+1
-1
strategy/strategy_test.go
strategy/strategy_test.go
+8
-8
No files found.
network/forwarder_test.go
View file @
ff4b979d
...
@@ -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"
)
)
...
...
strategy/strategy_test.go
View file @
ff4b979d
...
@@ -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
Strateg
ist
Strateg
y
}
}
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
)},
Strateg
ist
:
New
(),
Strateg
y
:
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
.
Block
IsWantedByPeer
(
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
.
Strateg
ist
)
{
if
!
peerIsPartner
(
seattle
.
Peer
,
sanfrancisco
.
Strateg
y
)
{
t
.
Fatal
(
"Peer wasn't added as a Partner"
)
t
.
Fatal
(
"Peer wasn't added as a Partner"
)
}
}
if
!
peerIsPartner
(
sanfrancisco
.
Peer
,
seattle
.
Strateg
ist
)
{
if
!
peerIsPartner
(
sanfrancisco
.
Peer
,
seattle
.
Strateg
y
)
{
t
.
Fatal
(
"Peer wasn't added as a Partner"
)
t
.
Fatal
(
"Peer wasn't added as a Partner"
)
}
}
}
}
func
peerIsPartner
(
p
*
peer
.
Peer
,
s
Strateg
ist
)
bool
{
func
peerIsPartner
(
p
*
peer
.
Peer
,
s
Strateg
y
)
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
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment