diff --git a/cmd/root.go b/cmd/root.go index 8017177e1fbb05bab918ed2f288fbdc37eac424a..853b5a48c1e43932e7bac5b4e0b1dd6e2f3042fe 100644 --- a/cmd/root.go +++ b/cmd/root.go @@ -247,7 +247,10 @@ var rootCmd = &cobra.Command{ } } fmt.Printf("Received %d\n", receiveCnt) - roundsNotepad.INFO.Printf("\n%s", client.GetNetworkInterface().GetVerboseRounds()) + if roundsNotepad!=nil{ + roundsNotepad.INFO.Printf("\n%s", client.GetNetworkInterface().GetVerboseRounds()) + } + err = client.StopNetworkFollower() if err != nil { jww.WARN.Printf( diff --git a/network/gateway/sender.go b/network/gateway/sender.go index 1ae30ccea55592574e0aa9813c0b2af6ed185d55..693fdf058130465048d00371b3c5c23dabb1a150 100644 --- a/network/gateway/sender.go +++ b/network/gateway/sender.go @@ -26,6 +26,8 @@ type Sender struct { *HostPool } +const RetryableError = "Nonfatal error occurred, please retry" + // NewSender Create a new Sender object wrapping a HostPool object func NewSender(poolParams PoolParams, rng *fastRNG.StreamGenerator, ndf *ndf.NetworkDefinition, getter HostManager, storage *storage.Session, addGateway chan network.NodeGateway) (*Sender, error) { @@ -47,10 +49,12 @@ func (s *Sender) SendToAny(sendFunc func(host *connect.Host) (interface{}, error return nil, errors.Errorf(stoppable.ErrMsg, stop.Name(), "SendToAny") }else if err==nil{ return result, nil - } else if strings.Contains(err.Error(),"unable to connect to target host") { + } else if strings.Contains(err.Error(), RetryableError) { // Retry of the proxy could not communicate - jww.WARN.Printf("Unable to SendToAny via %s: proxy could not contact requested host: %s", + jww.INFO.Printf("Unable to SendToAny via %s: non-fatal error received, retrying: %s", proxies[proxy].GetId().String(), err) + }else if strings.Contains(err.Error(),"unable to connect to target host") { + }else if replaced, checkReplaceErr := s.checkReplace(proxies[proxy].GetId(), err); replaced{ if checkReplaceErr!=nil{ jww.WARN.Printf("Unable to SendToAny, replaced a proxy %s with error %s", @@ -82,7 +86,11 @@ func (s *Sender) SendToPreferred(targets []*id.ID, return nil, errors.Errorf(stoppable.ErrMsg, stop.Name(), "SendToPreferred") } else if err == nil { return result, nil - } else if strings.Contains(err.Error(),"unable to connect to target host") { + } else if strings.Contains(err.Error(), RetryableError) { + // Retry of the proxy could not communicate + jww.INFO.Printf("Unable to to SendToPreferred first pass %s via %s: non-fatal error received, retrying: %s", + targets[i], targetHosts[i].GetId(), err) + }else if strings.Contains(err.Error(),"unable to connect to target host") { // Retry of the proxy could not communicate jww.WARN.Printf("Unable to SendToPreferred first pass %s via %s: %s, " + "proxy could not contact requested host", @@ -141,7 +149,11 @@ func (s *Sender) SendToPreferred(targets []*id.ID, return nil, errors.Errorf(stoppable.ErrMsg, stop.Name(), "SendToPreferred") } else if err == nil { return result, nil - } else if strings.Contains(err.Error(),"unable to connect to target host") { + } else if strings.Contains(err.Error(), RetryableError) { + // Retry of the proxy could not communicate + jww.INFO.Printf("Unable to SendToPreferred second pass %s via %s: non-fatal error received, retrying: %s", + target, proxy, err) + }else if strings.Contains(err.Error(),"unable to connect to target host") { // Retry of the proxy could not communicate jww.WARN.Printf("Unable to SendToPreferred second pass %s via %s: %s," + " proxy could not contact requested host", diff --git a/network/rounds/retrieve.go b/network/rounds/retrieve.go index bd7f1d682760d2f0160e2b9c4f9ca32f749bc534..cf1584a8d753b063e9b128dfcb15848ac5080bc0 100644 --- a/network/rounds/retrieve.go +++ b/network/rounds/retrieve.go @@ -11,6 +11,7 @@ import ( "encoding/binary" "github.com/pkg/errors" jww "github.com/spf13/jwalterweatherman" + "gitlab.com/elixxir/client/network/gateway" "gitlab.com/elixxir/client/network/message" "gitlab.com/elixxir/client/stoppable" "gitlab.com/elixxir/client/storage/reception" @@ -157,8 +158,8 @@ func (m *Manager) getMessagesFromGateway(roundID id.Round, // If the gateway doesnt have the round, return an error msgResp, err := comms.RequestMessages(host, msgReq) if err == nil && !msgResp.GetHasRound() { - jww.INFO.Printf("No round error for round %d received from %s", roundID, target) - return message.Bundle{}, errors.Errorf(noRoundError, roundID) + errRtn := errors.Errorf(noRoundError, roundID) + return message.Bundle{}, errors.WithMessage(errRtn,gateway.RetryableError) } return msgResp, err