diff --git a/cmd/ipfs/daemon.go b/cmd/ipfs/daemon.go index f11d8695270..0763f6eb28b 100644 --- a/cmd/ipfs/daemon.go +++ b/cmd/ipfs/daemon.go @@ -943,6 +943,11 @@ func serveTrustlessGatewayOverLibp2p(cctx *oldcmds.Context) (<-chan error, error errc <- h.Serve() }() + go func() { + <-node.Process.Closing() + h.Close() + }() + return errc, nil }