Skip to content
Snippets Groups Projects
Commit 904f1a31 authored by Benjamin Wenger's avatar Benjamin Wenger
Browse files

fixed a crash and message pickup bugs

parent 36df9c10
Branches
Tags
2 merge requests!53Release,!27Update deps
...@@ -247,7 +247,10 @@ var rootCmd = &cobra.Command{ ...@@ -247,7 +247,10 @@ var rootCmd = &cobra.Command{
} }
} }
fmt.Printf("Received %d\n", receiveCnt) fmt.Printf("Received %d\n", receiveCnt)
if roundsNotepad!=nil{
roundsNotepad.INFO.Printf("\n%s", client.GetNetworkInterface().GetVerboseRounds()) roundsNotepad.INFO.Printf("\n%s", client.GetNetworkInterface().GetVerboseRounds())
}
err = client.StopNetworkFollower() err = client.StopNetworkFollower()
if err != nil { if err != nil {
jww.WARN.Printf( jww.WARN.Printf(
......
...@@ -26,6 +26,8 @@ type Sender struct { ...@@ -26,6 +26,8 @@ type Sender struct {
*HostPool *HostPool
} }
const RetryableError = "Nonfatal error occurred, please retry"
// NewSender Create a new Sender object wrapping a HostPool object // NewSender Create a new Sender object wrapping a HostPool object
func NewSender(poolParams PoolParams, rng *fastRNG.StreamGenerator, ndf *ndf.NetworkDefinition, getter HostManager, func NewSender(poolParams PoolParams, rng *fastRNG.StreamGenerator, ndf *ndf.NetworkDefinition, getter HostManager,
storage *storage.Session, addGateway chan network.NodeGateway) (*Sender, error) { storage *storage.Session, addGateway chan network.NodeGateway) (*Sender, error) {
...@@ -47,10 +49,12 @@ func (s *Sender) SendToAny(sendFunc func(host *connect.Host) (interface{}, 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") return nil, errors.Errorf(stoppable.ErrMsg, stop.Name(), "SendToAny")
}else if err==nil{ }else if err==nil{
return result, 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 // 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) 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{ }else if replaced, checkReplaceErr := s.checkReplace(proxies[proxy].GetId(), err); replaced{
if checkReplaceErr!=nil{ if checkReplaceErr!=nil{
jww.WARN.Printf("Unable to SendToAny, replaced a proxy %s with error %s", jww.WARN.Printf("Unable to SendToAny, replaced a proxy %s with error %s",
...@@ -82,6 +86,10 @@ func (s *Sender) SendToPreferred(targets []*id.ID, ...@@ -82,6 +86,10 @@ func (s *Sender) SendToPreferred(targets []*id.ID,
return nil, errors.Errorf(stoppable.ErrMsg, stop.Name(), "SendToPreferred") return nil, errors.Errorf(stoppable.ErrMsg, stop.Name(), "SendToPreferred")
} else if err == nil { } else if err == nil {
return result, nil return result, nil
} 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") { }else if strings.Contains(err.Error(),"unable to connect to target host") {
// Retry of the proxy could not communicate // Retry of the proxy could not communicate
jww.WARN.Printf("Unable to SendToPreferred first pass %s via %s: %s, " + jww.WARN.Printf("Unable to SendToPreferred first pass %s via %s: %s, " +
...@@ -141,6 +149,10 @@ func (s *Sender) SendToPreferred(targets []*id.ID, ...@@ -141,6 +149,10 @@ func (s *Sender) SendToPreferred(targets []*id.ID,
return nil, errors.Errorf(stoppable.ErrMsg, stop.Name(), "SendToPreferred") return nil, errors.Errorf(stoppable.ErrMsg, stop.Name(), "SendToPreferred")
} else if err == nil { } else if err == nil {
return result, nil return result, nil
} 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") { }else if strings.Contains(err.Error(),"unable to connect to target host") {
// Retry of the proxy could not communicate // Retry of the proxy could not communicate
jww.WARN.Printf("Unable to SendToPreferred second pass %s via %s: %s," + jww.WARN.Printf("Unable to SendToPreferred second pass %s via %s: %s," +
......
...@@ -11,6 +11,7 @@ import ( ...@@ -11,6 +11,7 @@ import (
"encoding/binary" "encoding/binary"
"github.com/pkg/errors" "github.com/pkg/errors"
jww "github.com/spf13/jwalterweatherman" jww "github.com/spf13/jwalterweatherman"
"gitlab.com/elixxir/client/network/gateway"
"gitlab.com/elixxir/client/network/message" "gitlab.com/elixxir/client/network/message"
"gitlab.com/elixxir/client/stoppable" "gitlab.com/elixxir/client/stoppable"
"gitlab.com/elixxir/client/storage/reception" "gitlab.com/elixxir/client/storage/reception"
...@@ -157,8 +158,8 @@ func (m *Manager) getMessagesFromGateway(roundID id.Round, ...@@ -157,8 +158,8 @@ func (m *Manager) getMessagesFromGateway(roundID id.Round,
// If the gateway doesnt have the round, return an error // If the gateway doesnt have the round, return an error
msgResp, err := comms.RequestMessages(host, msgReq) msgResp, err := comms.RequestMessages(host, msgReq)
if err == nil && !msgResp.GetHasRound() { if err == nil && !msgResp.GetHasRound() {
jww.INFO.Printf("No round error for round %d received from %s", roundID, target) errRtn := errors.Errorf(noRoundError, roundID)
return message.Bundle{}, errors.Errorf(noRoundError, roundID) return message.Bundle{}, errors.WithMessage(errRtn,gateway.RetryableError)
} }
return msgResp, err return msgResp, err
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment