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
c11cf9a0
Commit
c11cf9a0
authored
Dec 16, 2014
by
Brian Tiger Chow
Committed by
Juan Batiz-Benet
Dec 17, 2014
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
rm unused method
License: MIT Signed-off-by:
Brian Tiger Chow
<
brian@perfmode.com
>
parent
c8f74e55
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
0 additions
and
27 deletions
+0
-27
decision/engine.go
decision/engine.go
+0
-10
decision/engine_test.go
decision/engine_test.go
+0
-17
No files found.
decision/engine.go
View file @
c11cf9a0
...
...
@@ -96,16 +96,6 @@ func (e *Engine) Peers() []peer.Peer {
return
response
}
// BlockIsWantedByPeer returns true if peer wants the block given by this
// key
func
(
e
*
Engine
)
BlockIsWantedByPeer
(
k
u
.
Key
,
p
peer
.
Peer
)
bool
{
e
.
lock
.
RLock
()
defer
e
.
lock
.
RUnlock
()
ledger
:=
e
.
findOrCreate
(
p
)
return
ledger
.
WantListContains
(
k
)
}
// MessageReceived performs book-keeping. Returns error if passed invalid
// arguments.
func
(
e
*
Engine
)
MessageReceived
(
p
peer
.
Peer
,
m
bsmsg
.
BitSwapMessage
)
error
{
...
...
decision/engine_test.go
View file @
c11cf9a0
...
...
@@ -60,23 +60,6 @@ func TestConsistentAccounting(t *testing.T) {
}
}
func
TestBlockRecordedAsWantedAfterMessageReceived
(
t
*
testing
.
T
)
{
beggar
:=
newPeerAndLedgermanager
(
"can't be chooser"
)
chooser
:=
newPeerAndLedgermanager
(
"chooses JIF"
)
block
:=
blocks
.
NewBlock
([]
byte
(
"data wanted by beggar"
))
messageFromBeggarToChooser
:=
message
.
New
()
messageFromBeggarToChooser
.
AddEntry
(
block
.
Key
(),
1
)
chooser
.
Engine
.
MessageReceived
(
beggar
.
Peer
,
messageFromBeggarToChooser
)
// for this test, doesn't matter if you record that beggar sent
if
!
chooser
.
Engine
.
BlockIsWantedByPeer
(
block
.
Key
(),
beggar
.
Peer
)
{
t
.
Fatal
(
"chooser failed to record that beggar wants block"
)
}
}
func
TestPeerIsAddedToPeersWhenMessageReceivedOrSent
(
t
*
testing
.
T
)
{
sanfrancisco
:=
newPeerAndLedgermanager
(
"sf"
)
...
...
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