netclient: pass by value -> reference (#919)

* netclient: pass by value -> reference

Updates various function arguments to accept config.ClientConfig
as a reference to avoid deep copying the struct.

Signed-off-by: John Sahhar <john@gravitl.com>
This commit is contained in:
john s
2022-03-20 23:43:17 -05:00
committed by GitHub
parent eb974dbd63
commit 24f292c934
6 changed files with 21 additions and 19 deletions

View File

@@ -24,7 +24,7 @@ import (
)
// JoinNetwork - helps a client join a network
func JoinNetwork(cfg config.ClientConfig, privateKey string, iscomms bool) error {
func JoinNetwork(cfg *config.ClientConfig, privateKey string, iscomms bool) error {
if cfg.Node.Network == "" {
return errors.New("no network provided")
}
@@ -35,7 +35,7 @@ func JoinNetwork(cfg config.ClientConfig, privateKey string, iscomms bool) error
return err
}
err = config.Write(&cfg, cfg.Network)
err = config.Write(cfg, cfg.Network)
if err != nil {
return err
}
@@ -211,7 +211,7 @@ func JoinNetwork(cfg config.ClientConfig, privateKey string, iscomms bool) error
cfg.Node = node
setListenPort(oldListenPort, &cfg)
setListenPort(oldListenPort, cfg)
err = config.ModConfig(&cfg.Node)
if err != nil {