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
a7170e4e
Commit
a7170e4e
authored
Oct 27, 2014
by
Brian Tiger Chow
Committed by
Juan Batiz-Benet
Nov 15, 2014
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
refctor(bitswap/network) replace Network interface with Dialer interface
parent
dfb0a9c6
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
6 deletions
+6
-6
network/ipfs_impl.go
network/ipfs_impl.go
+6
-6
No files found.
network/ipfs_impl.go
View file @
a7170e4e
...
@@ -15,11 +15,11 @@ import (
...
@@ -15,11 +15,11 @@ import (
var
log
=
util
.
Logger
(
"bitswap_network"
)
var
log
=
util
.
Logger
(
"bitswap_network"
)
// NewFromIpfsNetwork returns a BitSwapNetwork supported by underlying IPFS
// NewFromIpfsNetwork returns a BitSwapNetwork supported by underlying IPFS
//
Network
& Service
//
Dialer
& Service
func
NewFromIpfsNetwork
(
s
inet
.
Service
,
n
inet
.
Network
)
BitSwapNetwork
{
func
NewFromIpfsNetwork
(
s
inet
.
Service
,
dialer
inet
.
Dialer
)
BitSwapNetwork
{
bitswapNetwork
:=
impl
{
bitswapNetwork
:=
impl
{
service
:
s
,
service
:
s
,
net
:
n
,
dialer
:
dialer
,
}
}
s
.
SetHandler
(
&
bitswapNetwork
)
s
.
SetHandler
(
&
bitswapNetwork
)
return
&
bitswapNetwork
return
&
bitswapNetwork
...
@@ -29,7 +29,7 @@ func NewFromIpfsNetwork(s inet.Service, n inet.Network) BitSwapNetwork {
...
@@ -29,7 +29,7 @@ func NewFromIpfsNetwork(s inet.Service, n inet.Network) BitSwapNetwork {
// NetMessage objects, into the bitswap network interface.
// NetMessage objects, into the bitswap network interface.
type
impl
struct
{
type
impl
struct
{
service
inet
.
Service
service
inet
.
Service
net
inet
.
Network
dialer
inet
.
Dialer
// inbound messages from the network are forwarded to the receiver
// inbound messages from the network are forwarded to the receiver
receiver
Receiver
receiver
Receiver
...
@@ -68,8 +68,8 @@ func (bsnet *impl) HandleMessage(
...
@@ -68,8 +68,8 @@ func (bsnet *impl) HandleMessage(
return
outgoing
return
outgoing
}
}
func
(
adapter
*
impl
)
DialPeer
(
ctx
context
.
Context
,
p
peer
.
Peer
)
error
{
func
(
bsnet
*
impl
)
DialPeer
(
ctx
context
.
Context
,
p
peer
.
Peer
)
error
{
return
adapter
.
net
.
DialPeer
(
ctx
,
p
)
return
bsnet
.
dialer
.
DialPeer
(
ctx
,
p
)
}
}
func
(
bsnet
*
impl
)
SendMessage
(
func
(
bsnet
*
impl
)
SendMessage
(
...
...
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