From d6a2dd3ec69380abc114b59f87a69e7777f95c19 Mon Sep 17 00:00:00 2001 From: Rafael Sampaio <5679073+r4f4ss@users.noreply.github.com> Date: Wed, 18 Sep 2024 18:04:30 -0300 Subject: [PATCH] Transformation of closePortalRpcServer a method of Client to form a centralized management object --- cmd/shisui/main.go | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/cmd/shisui/main.go b/cmd/shisui/main.go index 2297b776c9..c2aa00e463 100644 --- a/cmd/shisui/main.go +++ b/cmd/shisui/main.go @@ -131,32 +131,32 @@ func sigInterrupt(clientChan <-chan *Client) { log.Warn("Waiting for the client to start...") } c := <-clientChan - closePortalRpcServer(c) + c.closePortalRpcServer() }() <-interrupt os.Exit(1) } -func closePortalRpcServer(client *Client) { +func (cli *Client) closePortalRpcServer() { log.Info("Closing Database...") - client.DiscV5API.DiscV5.LocalNode().Database().Close() + cli.DiscV5API.DiscV5.LocalNode().Database().Close() log.Info("Closing UDPv5 protocol...") - client.DiscV5API.DiscV5.Close() - if client.HistoryNetwork != nil { + cli.DiscV5API.DiscV5.Close() + if cli.HistoryNetwork != nil { log.Info("Closing history network...") - client.HistoryNetwork.Stop() + cli.HistoryNetwork.Stop() } - if client.BeaconNetwork != nil { + if cli.BeaconNetwork != nil { log.Info("Closing beacon network...") - client.BeaconNetwork.Stop() + cli.BeaconNetwork.Stop() } - if client.StateNetwork != nil { + if cli.StateNetwork != nil { log.Info("Closing state network...") - client.StateNetwork.Stop() + cli.StateNetwork.Stop() } log.Info("Closing servers...") - client.Server.Close() + cli.Server.Close() os.Exit(1) }