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
39138d13
Commit
39138d13
authored
Dec 23, 2014
by
Brian Tiger Chow
Committed by
Juan Batiz-Benet
Dec 23, 2014
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
chore(bitswap) remove Peerstore() methods from bitswap.Network interface
parent
aabe0a29
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
5 additions
and
18 deletions
+5
-18
network/interface.go
network/interface.go
+0
-2
network/ipfs_impl.go
network/ipfs_impl.go
+0
-4
testnet/network.go
testnet/network.go
+5
-12
No files found.
network/interface.go
View file @
39138d13
...
...
@@ -26,8 +26,6 @@ type BitSwapNetwork interface {
peer
.
ID
,
bsmsg
.
BitSwapMessage
)
(
incoming
bsmsg
.
BitSwapMessage
,
err
error
)
Peerstore
()
peer
.
Peerstore
// SetDelegate registers the Reciver to handle messages received from the
// network.
SetDelegate
(
Receiver
)
...
...
network/ipfs_impl.go
View file @
39138d13
...
...
@@ -72,10 +72,6 @@ func (bsnet *impl) SetDelegate(r Receiver) {
bsnet
.
receiver
=
r
}
func
(
bsnet
*
impl
)
Peerstore
()
peer
.
Peerstore
{
return
bsnet
.
Peerstore
()
}
// FindProvidersAsync returns a channel of providers for the given key
func
(
bsnet
*
impl
)
FindProvidersAsync
(
ctx
context
.
Context
,
k
util
.
Key
,
max
int
)
<-
chan
peer
.
ID
{
out
:=
make
(
chan
peer
.
ID
)
...
...
testnet/network.go
View file @
39138d13
...
...
@@ -52,10 +52,9 @@ type network struct {
func
(
n
*
network
)
Adapter
(
p
peer
.
ID
)
bsnet
.
BitSwapNetwork
{
client
:=
&
networkClient
{
local
:
p
,
network
:
n
,
peerstore
:
peer
.
NewPeerstore
(),
routing
:
n
.
routingserver
.
Client
(
peer
.
PeerInfo
{
ID
:
p
}),
local
:
p
,
network
:
n
,
routing
:
n
.
routingserver
.
Client
(
peer
.
PeerInfo
{
ID
:
p
}),
}
n
.
clients
[
p
]
=
client
return
client
...
...
@@ -155,9 +154,8 @@ func (n *network) SendRequest(
type
networkClient
struct
{
local
peer
.
ID
bsnet
.
Receiver
network
Network
peerstore
peer
.
Peerstore
routing
routing
.
IpfsRouting
network
Network
routing
routing
.
IpfsRouting
}
func
(
nc
*
networkClient
)
SendMessage
(
...
...
@@ -187,7 +185,6 @@ func (nc *networkClient) FindProvidersAsync(ctx context.Context, k util.Key, max
defer
close
(
out
)
providers
:=
nc
.
routing
.
FindProvidersAsync
(
ctx
,
k
,
max
)
for
info
:=
range
providers
{
nc
.
peerstore
.
AddAddresses
(
info
.
ID
,
info
.
Addrs
)
select
{
case
<-
ctx
.
Done
()
:
case
out
<-
info
.
ID
:
...
...
@@ -213,7 +210,3 @@ func (nc *networkClient) DialPeer(ctx context.Context, p peer.ID) error {
func
(
nc
*
networkClient
)
SetDelegate
(
r
bsnet
.
Receiver
)
{
nc
.
Receiver
=
r
}
func
(
nc
*
networkClient
)
Peerstore
()
peer
.
Peerstore
{
return
nc
.
peerstore
}
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