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
p2p
go-p2p-swarm
Commits
30c7cfd7
Commit
30c7cfd7
authored
Nov 03, 2016
by
Jeromy
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
implement GetStreams
parent
8838b1c2
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
18 additions
and
3 deletions
+18
-3
package.json
package.json
+2
-2
swarm_conn.go
swarm_conn.go
+7
-1
swarm_net_test.go
swarm_net_test.go
+9
-0
No files found.
package.json
View file @
30c7cfd7
...
@@ -69,9 +69,9 @@
...
@@ -69,9 +69,9 @@
},
},
{
{
"author"
:
"whyrusleeping"
,
"author"
:
"whyrusleeping"
,
"hash"
:
"Qm
NbLFRGG1uHVfQM2fRFrhc7dgjThXkYUAp5qChFqxYNSH
"
,
"hash"
:
"Qm
UQhsqvLehBDWjFq3C3nT6ZkGEsdPWSzxV6sNAzjRMfQQ
"
,
"name"
:
"go-peerstream"
,
"name"
:
"go-peerstream"
,
"version"
:
"1.
3
.0"
"version"
:
"1.
4
.0"
},
},
{
{
"author"
:
"whyrusleeping"
,
"author"
:
"whyrusleeping"
,
...
...
swarm_conn.go
View file @
30c7cfd7
...
@@ -92,7 +92,13 @@ func (c *Conn) Close() error {
...
@@ -92,7 +92,13 @@ func (c *Conn) Close() error {
}
}
func
(
c
*
Conn
)
GetStreams
()
([]
inet
.
Stream
,
error
)
{
func
(
c
*
Conn
)
GetStreams
()
([]
inet
.
Stream
,
error
)
{
return
nil
,
fmt
.
Errorf
(
"GetStreams() not yet implemented"
)
ss
:=
c
.
StreamConn
()
.
Streams
()
out
:=
make
([]
inet
.
Stream
,
len
(
ss
))
for
i
,
s
:=
range
ss
{
out
[
i
]
=
(
*
Stream
)(
s
)
}
return
out
,
nil
}
}
func
wrapConn
(
psc
*
ps
.
Conn
)
(
*
Conn
,
error
)
{
func
wrapConn
(
psc
*
ps
.
Conn
)
(
*
Conn
,
error
)
{
...
...
swarm_net_test.go
View file @
30c7cfd7
...
@@ -165,6 +165,15 @@ func TestNetworkOpenStream(t *testing.T) {
...
@@ -165,6 +165,15 @@ func TestNetworkOpenStream(t *testing.T) {
t
.
Fatal
(
err
)
t
.
Fatal
(
err
)
}
}
streams
,
err
:=
nets
[
0
]
.
ConnsToPeer
(
nets
[
1
]
.
LocalPeer
())[
0
]
.
GetStreams
()
if
err
!=
nil
{
t
.
Fatal
(
err
)
}
if
len
(
streams
)
!=
1
{
t
.
Fatal
(
"should only have one stream there"
)
}
_
,
err
=
s
.
Write
([]
byte
(
"hello ipfs"
))
_
,
err
=
s
.
Write
([]
byte
(
"hello ipfs"
))
if
err
!=
nil
{
if
err
!=
nil
{
t
.
Fatal
(
err
)
t
.
Fatal
(
err
)
...
...
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