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-dms3
Commits
faae63fc
Commit
faae63fc
authored
Jan 27, 2018
by
Steven Allen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
handle error from changed NewFloodSub method
License: MIT Signed-off-by:
Steven Allen
<
steven@stebalien.com
>
parent
5acbecc2
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
18 additions
and
4 deletions
+18
-4
core/core.go
core/core.go
+5
-1
namesys/pubsub_test.go
namesys/pubsub_test.go
+13
-3
No files found.
core/core.go
View file @
faae63fc
...
...
@@ -250,7 +250,11 @@ func (n *IpfsNode) startOnlineServices(ctx context.Context, routingOption Routin
}
if
pubsub
||
ipnsps
{
n
.
Floodsub
=
floodsub
.
NewFloodSub
(
ctx
,
peerhost
)
service
,
err
:=
floodsub
.
NewFloodSub
(
ctx
,
peerhost
)
if
err
!=
nil
{
return
err
}
n
.
Floodsub
=
service
}
if
ipnsps
{
...
...
namesys/pubsub_test.go
View file @
faae63fc
...
...
@@ -100,7 +100,11 @@ func TestPubsubPublishSubscribe(t *testing.T) {
pubhost
:=
newNetHost
(
ctx
,
t
)
pubmr
:=
newMockRouting
(
ms
,
ks
,
pubhost
)
pub
:=
NewPubsubPublisher
(
ctx
,
pubhost
,
ds
.
NewMapDatastore
(),
pubmr
,
floodsub
.
NewFloodSub
(
ctx
,
pubhost
))
fs
,
err
:=
floodsub
.
NewFloodSub
(
ctx
,
pubhost
)
if
err
!=
nil
{
t
.
Fatal
(
err
)
}
pub
:=
NewPubsubPublisher
(
ctx
,
pubhost
,
ds
.
NewMapDatastore
(),
pubmr
,
fs
)
privk
:=
pubhost
.
Peerstore
()
.
PrivKey
(
pubhost
.
ID
())
pubpinfo
:=
pstore
.
PeerInfo
{
ID
:
pubhost
.
ID
(),
Addrs
:
pubhost
.
Addrs
()}
...
...
@@ -110,7 +114,13 @@ func TestPubsubPublishSubscribe(t *testing.T) {
resmrs
:=
newMockRoutingForHosts
(
ms
,
ks
,
reshosts
)
res
:=
make
([]
*
PubsubResolver
,
len
(
reshosts
))
for
i
:=
0
;
i
<
len
(
res
);
i
++
{
res
[
i
]
=
NewPubsubResolver
(
ctx
,
reshosts
[
i
],
resmrs
[
i
],
ks
,
floodsub
.
NewFloodSub
(
ctx
,
reshosts
[
i
]))
fs
,
err
:=
floodsub
.
NewFloodSub
(
ctx
,
reshosts
[
i
])
if
err
!=
nil
{
t
.
Fatal
(
err
)
}
res
[
i
]
=
NewPubsubResolver
(
ctx
,
reshosts
[
i
],
resmrs
[
i
],
ks
,
fs
)
if
err
:=
reshosts
[
i
]
.
Connect
(
ctx
,
pubpinfo
);
err
!=
nil
{
t
.
Fatal
(
err
)
}
...
...
@@ -127,7 +137,7 @@ func TestPubsubPublishSubscribe(t *testing.T) {
time
.
Sleep
(
time
.
Second
*
1
)
val
:=
path
.
Path
(
"/ipfs/QmP1DfoUjiWH2ZBo1PBH6FupdBucbDepx3HpWmEY6JMUpY"
)
err
:
=
pub
.
Publish
(
ctx
,
privk
,
val
)
err
=
pub
.
Publish
(
ctx
,
privk
,
val
)
if
err
!=
nil
{
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