diff --git a/bindings/client.go b/bindings/client.go index 9274be1901f613afd99b6f03284401dac7ec983e..33ef281983799bab25a50663a71b151749ba3535 100644 --- a/bindings/client.go +++ b/bindings/client.go @@ -18,6 +18,7 @@ import ( "gitlab.com/elixxir/crypto/contact" "gitlab.com/elixxir/primitives/states" "gitlab.com/xx_network/primitives/id" + "gitlab.com/xx_network/primitives/netTime" "sync" "time" ) @@ -98,7 +99,7 @@ func Login(storageDir string, password []byte, parameters string) (*Client, erro return nil, errors.New(fmt.Sprintf("Failed to login: %+v", err)) } extantClient = true - clientSingleton :=&Client{api: *client} + clientSingleton := &Client{api: *client} return clientSingleton, nil } @@ -229,9 +230,9 @@ func (c *Client) StopNetworkFollower(timeoutMS int) error { // WaitForNewtwork will block until either the network is healthy or the // passed timeout. It will return true if the network is healthy func (c *Client) WaitForNetwork(timeoutMS int) bool { - start := time.Now() + start := netTime.Now() timeout := time.Duration(timeoutMS) * time.Millisecond - for time.Now().Sub(start) < timeout { + for netTime.Now().Sub(start) < timeout { if c.api.GetHealth().IsHealthy() { return true } diff --git a/network/follow.go b/network/follow.go index 0262bf708b3f55f20901a3d5fe3189b37ca343e2..bf868fe312ddf6b9eb5785d7b472c4ef3d894b2e 100644 --- a/network/follow.go +++ b/network/follow.go @@ -100,20 +100,17 @@ func (m *manager) follow(report interfaces.ClientErrorReport, rng csprng.Source, jww.DEBUG.Printf("Executing poll for %v(%s) range: %s-%s(%s) from %s", identity.EphId.Int64(), identity.Source, identity.StartRequest, identity.EndRequest, identity.EndRequest.Sub(identity.StartRequest), host.GetId()) - result, err := comms.SendPoll(host, &pollReq) - if err != nil { - if report != nil { - report( - "NetworkFollower", - fmt.Sprintf("Failed to poll network, \"%s\", Gateway: %s", err.Error(), host.String()), - fmt.Sprintf("%+v", err), - ) - } - jww.ERROR.Printf("Unable to poll %s for NDF: %+v", host, err) - } - return result, err + return comms.SendPoll(host, &pollReq) }) if err != nil { + if report != nil { + report( + "NetworkFollower", + fmt.Sprintf("Failed to poll network, \"%s\":", err.Error()), + fmt.Sprintf("%+v", err), + ) + } + jww.ERROR.Printf("Unable to poll gateways: %+v", err) return } diff --git a/network/gateway/hostPool.go b/network/gateway/hostPool.go index 305cc4ea1d111a7cf9c01eff94814ff59c98a2a0..34b381c67a928f0bce6c9e6d14e3fa9c87458644 100644 --- a/network/gateway/hostPool.go +++ b/network/gateway/hostPool.go @@ -22,6 +22,7 @@ import ( "gitlab.com/xx_network/comms/connect" "gitlab.com/xx_network/primitives/id" "gitlab.com/xx_network/primitives/ndf" + "golang.org/x/net/context" "io" "math" "strings" @@ -30,7 +31,7 @@ import ( ) // List of errors that initiate a Host replacement -var errorsList = []string{"context deadline exceeded", "connection refused", "host disconnected", +var errorsList = []string{context.DeadlineExceeded.Error(), "connection refused", "host disconnected", "transport is closing", "all SubConns are in TransientFailure", "Last try to connect", ndf.NO_NDF, "Host is in cool down"} @@ -80,7 +81,7 @@ func DefaultPoolParams() PoolParams { p.HostParams.EnableCoolOff = true p.HostParams.NumSendsBeforeCoolOff = 1 p.HostParams.CoolOffTimeout = 5 * time.Minute - p.HostParams.SendTimeout = 3500*time.Millisecond + p.HostParams.SendTimeout = 3500 * time.Millisecond return p }