mirror of
https://source.quilibrium.com/quilibrium/ceremonyclient.git
synced 2024-12-26 00:25:17 +00:00
31 lines
527 B
Go
31 lines
527 B
Go
package config
|
|
|
|
import (
|
|
"context"
|
|
|
|
basichost "github.com/libp2p/go-libp2p/p2p/host/basic"
|
|
routed "github.com/libp2p/go-libp2p/p2p/host/routed"
|
|
|
|
"go.uber.org/fx"
|
|
)
|
|
|
|
type closableBasicHost struct {
|
|
*fx.App
|
|
*basichost.BasicHost
|
|
}
|
|
|
|
func (h *closableBasicHost) Close() error {
|
|
_ = h.App.Stop(context.Background())
|
|
return h.BasicHost.Close()
|
|
}
|
|
|
|
type closableRoutedHost struct {
|
|
*fx.App
|
|
*routed.RoutedHost
|
|
}
|
|
|
|
func (h *closableRoutedHost) Close() error {
|
|
_ = h.App.Stop(context.Background())
|
|
return h.RoutedHost.Close()
|
|
}
|