diff --git a/network/gateway/hostPool.go b/network/gateway/hostPool.go index 43ae1481b9dcb01f732b12e6d6234fbc29acf5ff..0cb7fa6c03bba3432cdbcd84307ca57a7c12d682 100644 --- a/network/gateway/hostPool.go +++ b/network/gateway/hostPool.go @@ -462,7 +462,7 @@ func (h *HostPool) checkReplace(hostId *id.ID, hostErr error) (bool, error) { } h.hostMux.Unlock() } - return doReplace, err + return doReplace && err == nil, err } // Select a viable HostPool candidate from the NDF diff --git a/network/gateway/sender.go b/network/gateway/sender.go index b3b029f369bd91ada4f023f5fd77bb336e682177..6d7573d0d4f3a14f2ed64b69d3564236627b2e8b 100644 --- a/network/gateway/sender.go +++ b/network/gateway/sender.go @@ -55,6 +55,7 @@ func (s *Sender) SendToAny(sendFunc func(host *connect.Host) (interface{}, error // Retry of the proxy could not communicate jww.INFO.Printf("Unable to SendToAny via %s: non-fatal error received, retrying: %s", proxies[proxy].GetId().String(), err) + continue } else if strings.Contains(err.Error(), "unable to connect to target host") || strings.Contains(err.Error(), "unable to find target host") { // Retry of the proxy could not communicate @@ -62,15 +63,21 @@ func (s *Sender) SendToAny(sendFunc func(host *connect.Host) (interface{}, error " proxy could not contact requested host", proxies[proxy].GetId(), err) continue - } else if replaced, checkReplaceErr := s.checkReplace(proxies[proxy].GetId(), err); replaced { + } + + // Not retryable, now we must check whether the Host should be replaced + replaced, checkReplaceErr := s.checkReplace(proxies[proxy].GetId(), err) + if replaced { + jww.WARN.Printf("Unable to SendToAny, replaced a proxy %s with error %s", + proxies[proxy].GetId().String(), err.Error()) + } else { if checkReplaceErr != nil { - jww.WARN.Printf("Unable to SendToAny, replaced a proxy %s with error %s", - proxies[proxy].GetId().String(), checkReplaceErr) + jww.WARN.Printf("Unable to SendToAny via %s: %s. Unable to replace host: %+v", + proxies[proxy].GetId().String(), err.Error(), checkReplaceErr) } else { - jww.WARN.Printf("Unable to SendToAny, replaced a proxy %s", - proxies[proxy].GetId().String()) + jww.WARN.Printf("Unable to SendToAny via %s: %s. Did not replace host.", + proxies[proxy].GetId().String(), err.Error()) } - } else { return nil, errors.WithMessage(err, "Received error with SendToAny") } } @@ -111,6 +118,7 @@ func (s *Sender) SendToPreferred(targets []*id.ID, sendFunc sendToPreferredFunc, // 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) + continue } else if strings.Contains(err.Error(), "unable to connect to target host") || strings.Contains(err.Error(), "unable to find target host") { // Retry of the proxy could not communicate @@ -118,22 +126,21 @@ func (s *Sender) SendToPreferred(targets []*id.ID, sendFunc sendToPreferredFunc, "proxy could not contact requested host", targets[i], targetHosts[i].GetId(), err) continue - } else if replaced, checkReplaceErr := s.checkReplace(targetHosts[i].GetId(), err); replaced { + } + + // Not retryable, now we must check whether the Host should be replaced + replaced, checkReplaceErr := s.checkReplace(targetHosts[i].GetId(), err) + if replaced { + jww.WARN.Printf("Unable to SendToPreferred first pass via %s, replaced a proxy %s with error %s", + targets[i], targetHosts[i].GetId(), err.Error()) + } else { if checkReplaceErr != nil { - jww.WARN.Printf("Unable to SendToPreferred first pass %s via %s, "+ - "proxy failed, was replaced with error: %s", - targets[i], targetHosts[i].GetId(), checkReplaceErr) + jww.WARN.Printf("Unable to SendToPreferred first pass %s via %s: %s. Unable to replace host: %+v", + targets[i], targetHosts[i].GetId(), err.Error(), checkReplaceErr) } else { - jww.WARN.Printf("Unable to SendToPreferred first pass %s via %s, "+ - "proxy failed, was replaced", - targets[i], targetHosts[i].GetId()) + jww.WARN.Printf("Unable to SendToPreferred first pass %s via %s: %s. Did not replace host.", + targets[i], targetHosts[i].GetId(), err.Error()) } - jww.WARN.Printf("Unable to SendToPreferred first pass %s via %s: %s, proxy failed, was replaced", - targets[i], targetHosts[i].GetId(), checkReplaceErr) - continue - } else { - jww.WARN.Printf("Unable to SendToPreferred first pass %s via %s: %s, comm returned an error", - targets[i], targetHosts[i].GetId(), err) return result, err } } @@ -182,6 +189,7 @@ func (s *Sender) SendToPreferred(targets []*id.ID, sendFunc sendToPreferredFunc, // 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) + continue } else if strings.Contains(err.Error(), "unable to connect to target host") || strings.Contains(err.Error(), "unable to find target host") { // Retry of the proxy could not communicate @@ -189,21 +197,22 @@ func (s *Sender) SendToPreferred(targets []*id.ID, sendFunc sendToPreferredFunc, " proxy could not contact requested host", target, proxy, err) continue - } else if replaced, checkReplaceErr := s.checkReplace(proxy.GetId(), err); replaced { + } + + // Not retryable, now we must check whether the Host should be replaced + replaced, checkReplaceErr := s.checkReplace(proxy.GetId(), err) + badProxies[proxy.String()] = nil + if replaced { + jww.WARN.Printf("Unable to SendToPreferred second pass via %s, replaced a proxy %s with error %s", + target, proxy.GetId(), err.Error()) + } else { if checkReplaceErr != nil { - jww.WARN.Printf("Unable to SendToPreferred second pass %s via %s,"+ - "proxy failed, was replaced with error: %s", target, proxy.GetId(), - checkReplaceErr) + jww.WARN.Printf("Unable to SendToPreferred second pass %s via %s: %s. Unable to replace host: %+v", + target, proxy.GetId(), err.Error(), checkReplaceErr) } else { - jww.WARN.Printf("Unable to SendToPreferred second pass %s via %s, "+ - "proxy failed, was replaced", target, proxy.GetId()) + jww.WARN.Printf("Unable to SendToPreferred second pass %s via %s: %s. Did not replace host.", + target, proxy.GetId(), err.Error()) } - - badProxies[proxy.String()] = nil - continue - } else { - jww.WARN.Printf("Unable to SendToPreferred second pass %s via %s: %s, comm returned an error", - target, proxy.GetId(), err) return result, err } } diff --git a/network/rounds/check.go b/network/rounds/check.go index 295a63f0abdb607660c0e6bc6865e7d026d608f6..afcd20f1d52a0f1b089adb82b28606f576ebf1ec 100644 --- a/network/rounds/check.go +++ b/network/rounds/check.go @@ -56,11 +56,6 @@ func serializeRound(roundId id.Round) []byte { func (m *Manager) GetMessagesFromRound(roundID id.Round, identity reception.IdentityUse) { ri, err := m.Instance.GetRound(roundID) if err != nil || m.params.ForceHistoricalRounds { - if m.params.RealtimeOnly { - jww.WARN.Printf("Skipping round %d because it is not in ram and we are realtime only mode", - roundID) - return - } if m.params.ForceHistoricalRounds { jww.WARN.Printf("Forcing use of historical rounds for round ID %d.", roundID) diff --git a/single/reception.go b/single/reception.go index b4aa68f8341da6dba735639883239fcc1d0a97da..01faada1fa07ada31f779ec25f2eecc973f95f9b 100644 --- a/single/reception.go +++ b/single/reception.go @@ -114,9 +114,8 @@ func (m *Manager) processTransmission(msg format.Message, c := NewContact(payload.GetRID(transmitMsg.GetPubKey(grp)), transmitMsg.GetPubKey(grp), dhKey, payload.GetTagFP(), payload.GetMaxParts()) - jww.INFO.Printf("Generated by singe use receiver reception id for single use: %s, "+ - "ephId: %v, pubkey: %x", - c.partner, "unknown:", transmitMsg.GetPubKey(grp).Bytes()) + jww.INFO.Printf("Generated by singe use receiver reception id for single use. EphId %s, PubKey: %x", + c.partner, transmitMsg.GetPubKey(grp).Bytes()) return payload.GetContents(), c, nil }