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-routing
Commits
d3b46b8d
Commit
d3b46b8d
authored
Jun 22, 2015
by
rht
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use WithContextAndTeardown whenever possible
License: MIT Signed-off-by:
rht
<
rhtbot@gmail.com
>
parent
50d59a42
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
2 additions
and
3 deletions
+2
-3
dht/dht.go
dht/dht.go
+2
-3
No files found.
dht/dht.go
View file @
d3b46b8d
...
...
@@ -73,13 +73,12 @@ func NewDHT(ctx context.Context, h host.Host, dstore ds.ThreadSafeDatastore) *Ip
// register for network notifs.
dht
.
host
.
Network
()
.
Notify
((
*
netNotifiee
)(
dht
))
proc
:=
goprocessctx
.
WithContext
(
ctx
)
proc
.
SetTeardown
(
func
()
error
{
dht
.
proc
=
goprocessctx
.
WithContextAndTeardown
(
ctx
,
func
()
error
{
// remove ourselves from network notifs.
dht
.
host
.
Network
()
.
StopNotify
((
*
netNotifiee
)(
dht
))
return
nil
})
dht
.
proc
=
proc
dht
.
ctx
=
ctx
h
.
SetStreamHandler
(
ProtocolDHT
,
dht
.
handleNewStream
)
...
...
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