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
Commits
890f2e86
Unverified
Commit
890f2e86
authored
Jan 19, 2021
by
Aarsh Shah
Committed by
GitHub
Jan 19, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Close peerstore and document Host Close (#1037)
* close peerstore and docs change * update docs
parent
1c850e12
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
5 additions
and
1 deletion
+5
-1
libp2p.go
libp2p.go
+1
-1
p2p/host/basic/basic_host.go
p2p/host/basic/basic_host.go
+4
-0
No files found.
libp2p.go
View file @
890f2e86
...
...
@@ -52,7 +52,7 @@ func ChainOptions(opts ...Option) Option {
// - If no peerstore is provided, the host is initialized with an empty
// peerstore.
//
//
C
ancel
ing
the passed context
will stop
the returned
libp2p node
.
//
To stop/shutdown the returned libp2p node, the user needs to c
ancel the passed context
and call `Close` on
the returned
Host
.
func
New
(
ctx
context
.
Context
,
opts
...
Option
)
(
host
.
Host
,
error
)
{
return
NewWithoutDefaults
(
ctx
,
append
(
opts
,
FallbackDefaults
)
...
)
}
...
...
p2p/host/basic/basic_host.go
View file @
890f2e86
...
...
@@ -1007,6 +1007,10 @@ func (h *BasicHost) Close() error {
_
=
h
.
emitters
.
evtLocalAddrsUpdated
.
Close
()
h
.
Network
()
.
Close
()
if
h
.
Peerstore
()
!=
nil
{
h
.
Peerstore
()
.
Close
()
}
h
.
refCount
.
Wait
()
})
...
...
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