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
Show 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 {
...
@@ -26,8 +26,6 @@ type BitSwapNetwork interface {
peer
.
ID
,
peer
.
ID
,
bsmsg
.
BitSwapMessage
)
(
incoming
bsmsg
.
BitSwapMessage
,
err
error
)
bsmsg
.
BitSwapMessage
)
(
incoming
bsmsg
.
BitSwapMessage
,
err
error
)
Peerstore
()
peer
.
Peerstore
// SetDelegate registers the Reciver to handle messages received from the
// SetDelegate registers the Reciver to handle messages received from the
// network.
// network.
SetDelegate
(
Receiver
)
SetDelegate
(
Receiver
)
...
...
network/ipfs_impl.go
View file @
39138d13
...
@@ -72,10 +72,6 @@ func (bsnet *impl) SetDelegate(r Receiver) {
...
@@ -72,10 +72,6 @@ func (bsnet *impl) SetDelegate(r Receiver) {
bsnet
.
receiver
=
r
bsnet
.
receiver
=
r
}
}
func
(
bsnet
*
impl
)
Peerstore
()
peer
.
Peerstore
{
return
bsnet
.
Peerstore
()
}
// FindProvidersAsync returns a channel of providers for the given key
// 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
{
func
(
bsnet
*
impl
)
FindProvidersAsync
(
ctx
context
.
Context
,
k
util
.
Key
,
max
int
)
<-
chan
peer
.
ID
{
out
:=
make
(
chan
peer
.
ID
)
out
:=
make
(
chan
peer
.
ID
)
...
...
testnet/network.go
View file @
39138d13
...
@@ -54,7 +54,6 @@ func (n *network) Adapter(p peer.ID) bsnet.BitSwapNetwork {
...
@@ -54,7 +54,6 @@ func (n *network) Adapter(p peer.ID) bsnet.BitSwapNetwork {
client
:=
&
networkClient
{
client
:=
&
networkClient
{
local
:
p
,
local
:
p
,
network
:
n
,
network
:
n
,
peerstore
:
peer
.
NewPeerstore
(),
routing
:
n
.
routingserver
.
Client
(
peer
.
PeerInfo
{
ID
:
p
}),
routing
:
n
.
routingserver
.
Client
(
peer
.
PeerInfo
{
ID
:
p
}),
}
}
n
.
clients
[
p
]
=
client
n
.
clients
[
p
]
=
client
...
@@ -156,7 +155,6 @@ type networkClient struct {
...
@@ -156,7 +155,6 @@ type networkClient struct {
local
peer
.
ID
local
peer
.
ID
bsnet
.
Receiver
bsnet
.
Receiver
network
Network
network
Network
peerstore
peer
.
Peerstore
routing
routing
.
IpfsRouting
routing
routing
.
IpfsRouting
}
}
...
@@ -187,7 +185,6 @@ func (nc *networkClient) FindProvidersAsync(ctx context.Context, k util.Key, max
...
@@ -187,7 +185,6 @@ func (nc *networkClient) FindProvidersAsync(ctx context.Context, k util.Key, max
defer
close
(
out
)
defer
close
(
out
)
providers
:=
nc
.
routing
.
FindProvidersAsync
(
ctx
,
k
,
max
)
providers
:=
nc
.
routing
.
FindProvidersAsync
(
ctx
,
k
,
max
)
for
info
:=
range
providers
{
for
info
:=
range
providers
{
nc
.
peerstore
.
AddAddresses
(
info
.
ID
,
info
.
Addrs
)
select
{
select
{
case
<-
ctx
.
Done
()
:
case
<-
ctx
.
Done
()
:
case
out
<-
info
.
ID
:
case
out
<-
info
.
ID
:
...
@@ -213,7 +210,3 @@ func (nc *networkClient) DialPeer(ctx context.Context, p peer.ID) error {
...
@@ -213,7 +210,3 @@ func (nc *networkClient) DialPeer(ctx context.Context, p peer.ID) error {
func
(
nc
*
networkClient
)
SetDelegate
(
r
bsnet
.
Receiver
)
{
func
(
nc
*
networkClient
)
SetDelegate
(
r
bsnet
.
Receiver
)
{
nc
.
Receiver
=
r
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