mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-09 13:33:50 +00:00
Transformation of closePortalRpcServer a method of Client to form a centralized management object
This commit is contained in:
parent
2e8d67992a
commit
d6a2dd3ec6
1 changed files with 11 additions and 11 deletions
|
|
@ -131,32 +131,32 @@ func sigInterrupt(clientChan <-chan *Client) {
|
||||||
log.Warn("Waiting for the client to start...")
|
log.Warn("Waiting for the client to start...")
|
||||||
}
|
}
|
||||||
c := <-clientChan
|
c := <-clientChan
|
||||||
closePortalRpcServer(c)
|
c.closePortalRpcServer()
|
||||||
}()
|
}()
|
||||||
|
|
||||||
<-interrupt
|
<-interrupt
|
||||||
os.Exit(1)
|
os.Exit(1)
|
||||||
}
|
}
|
||||||
|
|
||||||
func closePortalRpcServer(client *Client) {
|
func (cli *Client) closePortalRpcServer() {
|
||||||
log.Info("Closing Database...")
|
log.Info("Closing Database...")
|
||||||
client.DiscV5API.DiscV5.LocalNode().Database().Close()
|
cli.DiscV5API.DiscV5.LocalNode().Database().Close()
|
||||||
log.Info("Closing UDPv5 protocol...")
|
log.Info("Closing UDPv5 protocol...")
|
||||||
client.DiscV5API.DiscV5.Close()
|
cli.DiscV5API.DiscV5.Close()
|
||||||
if client.HistoryNetwork != nil {
|
if cli.HistoryNetwork != nil {
|
||||||
log.Info("Closing history network...")
|
log.Info("Closing history network...")
|
||||||
client.HistoryNetwork.Stop()
|
cli.HistoryNetwork.Stop()
|
||||||
}
|
}
|
||||||
if client.BeaconNetwork != nil {
|
if cli.BeaconNetwork != nil {
|
||||||
log.Info("Closing beacon network...")
|
log.Info("Closing beacon network...")
|
||||||
client.BeaconNetwork.Stop()
|
cli.BeaconNetwork.Stop()
|
||||||
}
|
}
|
||||||
if client.StateNetwork != nil {
|
if cli.StateNetwork != nil {
|
||||||
log.Info("Closing state network...")
|
log.Info("Closing state network...")
|
||||||
client.StateNetwork.Stop()
|
cli.StateNetwork.Stop()
|
||||||
}
|
}
|
||||||
log.Info("Closing servers...")
|
log.Info("Closing servers...")
|
||||||
client.Server.Close()
|
cli.Server.Close()
|
||||||
|
|
||||||
os.Exit(1)
|
os.Exit(1)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue