From 6e5c4351b8b340d00a0e99406e25d9cfcf1993cb Mon Sep 17 00:00:00 2001 From: Jake Taylor <jake@elixxir.io> Date: Thu, 17 Jun 2021 12:44:06 -0500 Subject: [PATCH] added Keepalive opts --- api/client.go | 8 +++++--- ud/manager.go | 3 +++ 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/api/client.go b/api/client.go index 5bbad8f8c..a81bb2535 100644 --- a/api/client.go +++ b/api/client.go @@ -30,6 +30,7 @@ import ( "gitlab.com/xx_network/crypto/signature/rsa" "gitlab.com/xx_network/primitives/id" "gitlab.com/xx_network/primitives/ndf" + "math" "sync" "time" ) @@ -235,6 +236,8 @@ func Login(storageDir string, password []byte, parameters params.Network) (*Clie if def.Notification.Address != "" { hp := connect.GetDefaultHostParams() + // Client will not send KeepAlive packets + hp.KaClientOpts.Time = time.Duration(math.MaxInt64) hp.AuthEnabled = false hp.MaxRetries = 5 _, err = c.comms.AddHost(&id.NotificationBot, def.Notification.Address, []byte(def.Notification.TlsCertificate), hp) @@ -392,11 +395,10 @@ func (c *Client) StartNetworkFollower(timeout time.Duration) (<-chan interfaces. jww.INFO.Printf("StartNetworkFollower() \n\tTransmisstionID: %s "+ "\n\tReceptionID: %s", u.TransmissionID, u.ReceptionID) - if status := c.status.get(); status != Stopped{ + if status := c.status.get(); status != Stopped { return nil, errors.Errorf("Cannot Stop the Network Follower when it is not running, status: %s", status) } - c.clientErrorChannel = make(chan interfaces.ClientError, 1000) cer := func(source, message, trace string) { @@ -456,7 +458,7 @@ func (c *Client) StopNetworkFollower() error { c.followerLock.Lock() defer c.followerLock.Unlock() - if status := c.status.get(); status != Running{ + if status := c.status.get(); status != Running { return errors.Errorf("Cannot Stop the Network Follower when it is not running, status: %s", status) } diff --git a/ud/manager.go b/ud/manager.go index f3b7afc64..1397b8e2d 100644 --- a/ud/manager.go +++ b/ud/manager.go @@ -15,6 +15,7 @@ import ( "gitlab.com/xx_network/comms/connect" "gitlab.com/xx_network/crypto/signature/rsa" "gitlab.com/xx_network/primitives/id" + "math" "time" ) @@ -89,6 +90,8 @@ func NewManager(client *api.Client, single *single.Manager) (*Manager, error) { // Create the user discovery host object hp := connect.GetDefaultHostParams() + // Client will not send KeepAlive packets + hp.KaClientOpts.Time = time.Duration(math.MaxInt64) hp.MaxRetries = 3 hp.SendTimeout = 3 * time.Second m.host, err = m.comms.AddHost(&id.UDB, def.UDB.Address, []byte(def.UDB.Cert), hp) -- GitLab