fix: make sure to close the mocknet's context when canceled

This commit is contained in:
Steven Allen 2020-03-23 14:27:04 -07:00
parent 223cd42251
commit 5403811df9
1 changed files with 4 additions and 1 deletions

View File

@ -46,11 +46,14 @@ type mocknet struct {
}
func New(ctx context.Context) Mocknet {
proc := goprocessctx.WithContext(ctx)
ctx = goprocessctx.WithProcessClosing(ctx, proc)
return &mocknet{
nets: map[peer.ID]*peernet{},
hosts: map[peer.ID]*bhost.BasicHost{},
links: map[peer.ID]map[peer.ID]map[*link]struct{}{},
proc: goprocessctx.WithContext(ctx),
proc: proc,
ctx: ctx,
}
}