From 41e7222b989086faca5f6c764e9ad8461d8f812a Mon Sep 17 00:00:00 2001 From: hyung-hwan Date: Tue, 10 Dec 2024 14:57:11 +0900 Subject: [PATCH] fixed wrong config access --- cmd/main.go | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/cmd/main.go b/cmd/main.go index eb92d3a..6c4d5e5 100644 --- a/cmd/main.go +++ b/cmd/main.go @@ -150,6 +150,8 @@ func server_main(ctl_addrs []string, rpc_addrs []string, cfg *ServerConfig) erro var ctl_prefix string var logger *AppLogger var log_mask hodu.LogMask + var max_rpc_conns int + var max_peers int var err error log_mask = hodu.LOG_ALL @@ -174,6 +176,8 @@ func server_main(ctl_addrs []string, rpc_addrs []string, cfg *ServerConfig) erro ctl_prefix = cfg.CTL.Service.Prefix log_mask = log_strings_to_mask(cfg.APP.LogMask) + max_rpc_conns = cfg.APP.MaxRpcConns + max_peers = cfg.APP.MaxPeers } if len(rpc_addrs) <= 0 { @@ -190,8 +194,8 @@ func server_main(ctl_addrs []string, rpc_addrs []string, cfg *ServerConfig) erro ctl_prefix, ctltlscfg, rpctlscfg, - cfg.APP.MaxRpcConns, - cfg.APP.MaxPeers) + max_rpc_conns, + max_peers) if err != nil { return fmt.Errorf("failed to create new server - %s", err.Error()) } @@ -214,6 +218,9 @@ func client_main(ctl_addrs []string, rpc_addrs []string, peer_addrs []string, cf var cc hodu.ClientConfig var logger *AppLogger var log_mask hodu.LogMask + var max_rpc_conns int + var max_peers int + var peer_conn_tmout time.Duration var err error log_mask = hodu.LOG_ALL @@ -234,6 +241,9 @@ func client_main(ctl_addrs []string, rpc_addrs []string, peer_addrs []string, cf cc.ServerSeedTmout = cfg.RPC.Endpoint.SeedTmout cc.ServerAuthority = cfg.RPC.Endpoint.Authority log_mask = log_strings_to_mask(cfg.APP.LogMask) + max_rpc_conns = cfg.APP.MaxRpcConns + max_peers = cfg.APP.MaxPeers + peer_conn_tmout = cfg.APP.PeerConnTmout } // unlke the server, we allow the client to start with no rpc address. @@ -249,9 +259,9 @@ func client_main(ctl_addrs []string, rpc_addrs []string, peer_addrs []string, cf ctl_prefix, ctltlscfg, rpctlscfg, - cfg.APP.MaxRpcConns, - cfg.APP.MaxPeers, - cfg.APP.PeerConnTmout) + max_rpc_conns, + max_peers, + peer_conn_tmout) c.StartService(&cc) c.StartCtlService() // control channel