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
cb8a96a1
Commit
cb8a96a1
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
style(bitswap) public methods at top
parent
e42045ad
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
23 additions
and
23 deletions
+23
-23
network/ipfs_impl.go
network/ipfs_impl.go
+23
-23
No files found.
network/ipfs_impl.go
View file @
cb8a96a1
...
...
@@ -30,29 +30,6 @@ type impl struct {
receiver
Receiver
}
// handleNewStream receives a new stream from the network.
func
(
bsnet
*
impl
)
handleNewStream
(
s
inet
.
Stream
)
{
if
bsnet
.
receiver
==
nil
{
return
}
go
func
()
{
defer
s
.
Close
()
received
,
err
:=
bsmsg
.
FromNet
(
s
)
if
err
!=
nil
{
go
bsnet
.
receiver
.
ReceiveError
(
err
)
return
}
p
:=
s
.
Conn
()
.
RemotePeer
()
ctx
:=
context
.
Background
()
bsnet
.
receiver
.
ReceiveMessage
(
ctx
,
p
,
received
)
}()
}
func
(
bsnet
*
impl
)
DialPeer
(
ctx
context
.
Context
,
p
peer
.
ID
)
error
{
return
bsnet
.
network
.
DialPeer
(
ctx
,
p
)
}
...
...
@@ -92,3 +69,26 @@ func (bsnet *impl) SendRequest(
func
(
bsnet
*
impl
)
SetDelegate
(
r
Receiver
)
{
bsnet
.
receiver
=
r
}
// handleNewStream receives a new stream from the network.
func
(
bsnet
*
impl
)
handleNewStream
(
s
inet
.
Stream
)
{
if
bsnet
.
receiver
==
nil
{
return
}
go
func
()
{
defer
s
.
Close
()
received
,
err
:=
bsmsg
.
FromNet
(
s
)
if
err
!=
nil
{
go
bsnet
.
receiver
.
ReceiveError
(
err
)
return
}
p
:=
s
.
Conn
()
.
RemotePeer
()
ctx
:=
context
.
Background
()
bsnet
.
receiver
.
ReceiveMessage
(
ctx
,
p
,
received
)
}()
}
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