1
0
mirror of https://github.com/ipfs/kubo.git synced 2025-07-01 02:30:39 +08:00

cancel on exit

This commit is contained in:
Brian Tiger Chow
2014-12-24 09:26:43 -05:00
parent 35f6ddb8fa
commit d619e4ada9

View File

@ -89,7 +89,8 @@ func RandomBytes(n int64) []byte {
} }
func AddCatBytes(data []byte, conf Config) error { func AddCatBytes(data []byte, conf Config) error {
ctx := context.Background() ctx, cancel := context.WithCancel(context.Background())
defer cancel()
mn := mocknet.New(ctx) mn := mocknet.New(ctx)
// defer mn.Close() FIXME does mocknet require clean-up // defer mn.Close() FIXME does mocknet require clean-up
mn.SetLinkDefaults(mocknet.LinkOptions{ mn.SetLinkDefaults(mocknet.LinkOptions{