提交 c9d30849 作者: Tor Arne Vestbø 提交者: Tor Arne Vestbø

corehttp: ensure node closing/teardown waits for server termination

When closing a node, the node itself only takes care of tearing down
its own children. As corehttp sets up a server based on a node, it
needs to also ensure that the server is accounted for when determining
if the node has been fully closed.
上级 cc830ff2
......@@ -64,6 +64,9 @@ func listenAndServe(node *core.IpfsNode, addr ma.Multiaddr, handler http.Handler
var serverError error
serverExited := make(chan struct{})
node.Children().Add(1)
defer node.Children().Done()
go func() {
serverError = server.ListenAndServe(host, handler)
close(serverExited)
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论