diff --git a/api/results.go b/api/results.go index 919ae478a1797e5cff8175efbe0025f15d8ec479..da57e4c5180b622e5d8c6c8a9312cc081f797801 100644 --- a/api/results.go +++ b/api/results.go @@ -182,7 +182,7 @@ func (c *Client) getHistoricalRounds(msg *pb.HistoricalRounds, for { // Find a gateway to request about the roundRequests - result, err := c.GetNetworkInterface().GetSender().SendToAny(1, func(host *connect.Host) (interface{}, error) { + result, err := c.GetNetworkInterface().GetSender().SendToAny(func(host *connect.Host) (interface{}, error) { return comms.RequestHistoricalRounds(host, msg) }) diff --git a/api/utilsInterfaces_test.go b/api/utilsInterfaces_test.go index ffa5154795045f361afd70d8cb67d0c45eb6e4c4..8d63541750796aefb1d27f793cac0a8f41517ab2 100644 --- a/api/utilsInterfaces_test.go +++ b/api/utilsInterfaces_test.go @@ -10,6 +10,7 @@ import ( "gitlab.com/elixxir/client/interfaces" "gitlab.com/elixxir/client/interfaces/message" "gitlab.com/elixxir/client/interfaces/params" + "gitlab.com/elixxir/client/network/gateway" "gitlab.com/elixxir/client/stoppable" pb "gitlab.com/elixxir/comms/mixmessages" "gitlab.com/elixxir/comms/network" @@ -119,3 +120,7 @@ func (t *testNetworkManagerGeneric) GetStoppable() stoppable.Stoppable { func (t *testNetworkManagerGeneric) InProgressRegistrations() int { return 0 } + +func (t *testNetworkManagerGeneric) GetSender() *gateway.Sender { + return nil +} diff --git a/keyExchange/utils_test.go b/keyExchange/utils_test.go index a1447b990744f92b063420888ea1c96e1d9fb5dd..a23e673f3a258164e4e2c407defbb5dabd5394d9 100644 --- a/keyExchange/utils_test.go +++ b/keyExchange/utils_test.go @@ -13,6 +13,7 @@ import ( "gitlab.com/elixxir/client/interfaces" "gitlab.com/elixxir/client/interfaces/message" "gitlab.com/elixxir/client/interfaces/params" + "gitlab.com/elixxir/client/network/gateway" "gitlab.com/elixxir/client/stoppable" "gitlab.com/elixxir/client/storage" "gitlab.com/elixxir/client/storage/e2e" @@ -103,6 +104,10 @@ func (t *testNetworkManagerGeneric) InProgressRegistrations() int { return 0 } +func (t *testNetworkManagerGeneric) GetSender() *gateway.Sender { + return nil +} + func InitTestingContextGeneric(i interface{}) (*storage.Session, interfaces.NetworkManager) { switch i.(type) { case *testing.T, *testing.M, *testing.B, *testing.PB: @@ -210,6 +215,10 @@ func (t *testNetworkManagerFullExchange) InProgressRegistrations() int { return 0 } +func (t *testNetworkManagerFullExchange) GetSender() *gateway.Sender { + return nil +} + func InitTestingContextFullExchange(i interface{}) (*storage.Session, *switchboard.Switchboard, interfaces.NetworkManager) { switch i.(type) { case *testing.T, *testing.M, *testing.B, *testing.PB: diff --git a/network/ephemeral/testutil.go b/network/ephemeral/testutil.go index fbcc4e3e8d031097f4d9447c0904f537451b3d40..d2708b0c71c7d112151e4494d3ef631a78adaf62 100644 --- a/network/ephemeral/testutil.go +++ b/network/ephemeral/testutil.go @@ -8,6 +8,7 @@ package ephemeral import ( + "gitlab.com/elixxir/client/network/gateway" "testing" jww "github.com/spf13/jwalterweatherman" @@ -79,6 +80,10 @@ func (t *testNetworkManager) InProgressRegistrations() int { return 0 } +func (t *testNetworkManager) GetSender() *gateway.Sender { + return nil +} + func NewTestNetworkManager(i interface{}) interfaces.NetworkManager { switch i.(type) { case *testing.T, *testing.M, *testing.B: diff --git a/network/follow.go b/network/follow.go index 14cc5a517fe677cbae6953976c813c4271fe4733..f05f2f641e1149d6e4d028f605b9b2a5b5e995eb 100644 --- a/network/follow.go +++ b/network/follow.go @@ -23,7 +23,6 @@ package network // instance import ( - "bytes" "fmt" "math" "time" @@ -33,7 +32,6 @@ import ( "gitlab.com/elixxir/client/network/rounds" pb "gitlab.com/elixxir/comms/mixmessages" "gitlab.com/elixxir/primitives/knownRounds" - "gitlab.com/elixxir/primitives/states" "gitlab.com/xx_network/comms/connect" "gitlab.com/xx_network/crypto/csprng" "gitlab.com/xx_network/primitives/id" @@ -151,52 +149,52 @@ func (m *manager) follow(report interfaces.ClientErrorReport, rng csprng.Source, return } + // TODO: ClientErr needs to know the source of the error and it doesn't yet // Iterate over ClientErrors for each RoundUpdate - for _, update := range pollResp.Updates { - - // Ignore irrelevant updates - if update.State != uint32(states.COMPLETED) && update.State != uint32(states.FAILED) { - continue - } - - for _, clientErr := range update.ClientErrors { - - // If this Client appears in the ClientError - if bytes.Equal(clientErr.ClientId, m.Session.GetUser().TransmissionID.Marshal()) { - - // Obtain relevant NodeGateway information - // TODO ??? - nGw, err := m.Instance.GetNodeAndGateway(gwHost.GetId()) - if err != nil { - jww.ERROR.Printf("Unable to get NodeGateway: %+v", err) - return - } - nid, err := nGw.Node.GetNodeId() - if err != nil { - jww.ERROR.Printf("Unable to get NodeID: %+v", err) - return - } - - // FIXME: Should be able to trigger proper type of round event - // FIXME: without mutating the RoundInfo. Signature also needs verified - // FIXME: before keys are deleted - update.State = uint32(states.FAILED) - rnd, err := m.Instance.GetWrappedRound(id.Round(update.ID)) - if err != nil { - jww.ERROR.Printf("Failed to report client error: "+ - "Could not get round for event triggering: "+ - "Unable to get round %d from instance: %+v", - id.Round(update.ID), err) - break - } - m.Instance.GetRoundEvents().TriggerRoundEvent(rnd) - - // delete all existing keys and trigger a re-registration with the relevant Node - m.Session.Cmix().Remove(nid) - m.Instance.GetAddGatewayChan() <- nGw - } - } - } + //for _, update := range pollResp.Updates { + // + // // Ignore irrelevant updates + // if update.State != uint32(states.COMPLETED) && update.State != uint32(states.FAILED) { + // continue + // } + // + // for _, clientErr := range update.ClientErrors { + // // If this Client appears in the ClientError + // if bytes.Equal(clientErr.ClientId, m.Session.GetUser().TransmissionID.Marshal()) { + // + // // Obtain relevant NodeGateway information + // // TODO ??? + // nGw, err := m.Instance.GetNodeAndGateway(gwHost.GetId()) + // if err != nil { + // jww.ERROR.Printf("Unable to get NodeGateway: %+v", err) + // return + // } + // nid, err := nGw.Node.GetNodeId() + // if err != nil { + // jww.ERROR.Printf("Unable to get NodeID: %+v", err) + // return + // } + // + // // FIXME: Should be able to trigger proper type of round event + // // FIXME: without mutating the RoundInfo. Signature also needs verified + // // FIXME: before keys are deleted + // update.State = uint32(states.FAILED) + // rnd, err := m.Instance.GetWrappedRound(id.Round(update.ID)) + // if err != nil { + // jww.ERROR.Printf("Failed to report client error: "+ + // "Could not get round for event triggering: "+ + // "Unable to get round %d from instance: %+v", + // id.Round(update.ID), err) + // break + // } + // m.Instance.GetRoundEvents().TriggerRoundEvent(rnd) + // + // // delete all existing keys and trigger a re-registration with the relevant Node + // m.Session.Cmix().Remove(nid) + // m.Instance.GetAddGatewayChan() <- nGw + // } + // } + //} } // ---- Identity Specific Round Processing ----- diff --git a/network/gateway/hostPool.go b/network/gateway/hostPool.go index 82f1b63a98d94523e7300a04c52a3e4f96cf6d4d..ba6cd338a2c2c74f8c708a9dce930bdefb35c1c2 100644 --- a/network/gateway/hostPool.go +++ b/network/gateway/hostPool.go @@ -27,14 +27,14 @@ import ( "time" ) -// Interface allowing storage and retrieval of Host objects +// HostManager Interface allowing storage and retrieval of Host objects type HostManager interface { GetHost(hostId *id.ID) (*connect.Host, bool) AddHost(hid *id.ID, address string, cert []byte, params connect.HostParams) (host *connect.Host, err error) RemoveHost(hid *id.ID) } -// Handles providing hosts to the Client +// HostPool Handles providing hosts to the Client type HostPool struct { hostMap map[id.ID]uint32 // map key to its index in the slice hostList []*connect.Host // each index in the slice contains the value @@ -52,24 +52,29 @@ type HostPool struct { addGatewayChan chan network.NodeGateway } -// Allows configuration of HostPool parameters +// PoolParams Allows configuration of HostPool parameters type PoolParams struct { - PoolSize uint32 // Quantity of Hosts in the HostPool - ErrThreshold uint64 // How many errors will cause a Host to be ejected from the HostPool - PruneInterval time.Duration // How frequently the HostPool updates the pool + PoolSize uint32 // Quantity of Hosts in the HostPool + ErrThreshold uint64 // How many errors will cause a Host to be ejected from the HostPool + PruneInterval time.Duration // How frequently the HostPool updates the pool + // TODO: Move up a layer ProxyAttempts uint32 // How many proxies will be used in event of send failure HostParams connect.HostParams // Parameters for the creation of new Host objects } -// Returns a default set of PoolParams +// DefaultPoolParams Returns a default set of PoolParams func DefaultPoolParams() PoolParams { - return PoolParams{ + p := PoolParams{ PoolSize: 30, ErrThreshold: 1, PruneInterval: 10 * time.Second, ProxyAttempts: 5, HostParams: connect.GetDefaultHostParams(), } + p.HostParams.EnableMetrics = true + p.HostParams.MaxRetries = 1 + p.HostParams.AuthEnabled = false + return p } // Build and return new HostPool object @@ -86,20 +91,24 @@ func newHostPool(poolParams PoolParams, rng io.Reader, ndf *ndf.NetworkDefinitio addGatewayChan: addGateway, } + // Propagate the NDF and return + err := result.updateConns() + if err != nil { + return nil, err + } + // Build the initial HostPool - err := result.pruneHostPool() + err = result.pruneHostPool() if err != nil { return nil, err } // Convert the NDF into an empty map object in order to allow updateConns - result.ndfMap, _ = convertNdfToMap(nil) - - // Propagate the NDF and return - return result, result.updateConns() + result.ndfMap, err = convertNdfToMap(nil) + return result, err } -// Mutates internal ndf to the given ndf +// UpdateNdf Mutates internal ndf to the given ndf func (h *HostPool) UpdateNdf(ndf *ndf.NetworkDefinition) { h.ndfMux.Lock() h.isNdfUpdated = true @@ -137,13 +146,13 @@ func (h *HostPool) getAny(length uint32, excluded []*id.ID) []*connect.Host { } // Obtain a specific connect.Host from the manager, irrespective of the HostPool -func (h *HostPool) GetSpecific(target *id.ID) (*connect.Host, bool) { +func (h *HostPool) getSpecific(target *id.ID) (*connect.Host, bool) { return h.manager.GetHost(target) } // Try to obtain the given targets from the HostPool // If each is not present, obtain a random replacement from the HostPool -func (h *HostPool) GetPreferred(targets []*id.ID) []*connect.Host { +func (h *HostPool) getPreferred(targets []*id.ID) []*connect.Host { checked := make(map[uint32]interface{}) // Keep track of Hosts already selected to avoid duplicates length := len(targets) if length > int(h.poolParams.PoolSize) { @@ -171,7 +180,7 @@ func (h *HostPool) GetPreferred(targets []*id.ID) []*connect.Host { return result } -// Start long-running thread and return the thread controller to the caller +// StartHostPool Start long-running thread and return the thread controller to the caller func (h *HostPool) StartHostPool() stoppable.Stoppable { stopper := stoppable.NewSingle("HostPool") jww.INFO.Printf("Starting Host Pool...") @@ -272,7 +281,7 @@ func (h *HostPool) replaceHost(newId *id.ID, oldPoolIndex uint32) error { } // Force-add the Gateways to the HostPool, each replacing a random Gateway -func (h *HostPool) ForceAdd(gwIds []*id.ID) error { +func (h *HostPool) forceAdd(gwIds []*id.ID) error { h.hostMux.Lock() defer h.hostMux.Unlock() @@ -280,6 +289,8 @@ func (h *HostPool) ForceAdd(gwIds []*id.ID) error { for i := 0; i < len(gwIds); { // Verify the GwId is not already in the hostMap if _, ok := h.hostMap[*gwIds[i]]; ok { + // If it is, skip + i++ continue } diff --git a/network/gateway/hostpool_test.go b/network/gateway/hostpool_test.go index db145a8cc2fb19ad299b18b37a80231f1b1cb3b8..a1feb5a37880e313e68ac465a66fd427b5875b1a 100644 --- a/network/gateway/hostpool_test.go +++ b/network/gateway/hostpool_test.go @@ -429,7 +429,7 @@ func TestHostPool_GetPreferred(t *testing.T) { t.Errorf("Failed to create mock host pool: %v", err) } - retrievedList := testPool.GetPreferred(targets) + retrievedList := testPool.getPreferred(targets) if len(retrievedList) != len(targets) { t.Errorf("Requested list did not output requested length."+ "\n\tExpected: %d"+ @@ -447,7 +447,7 @@ func TestHostPool_GetPreferred(t *testing.T) { // Replace a request with a gateway not in pool targets[3] = id.NewIdFromUInt(74, id.Gateway, t) - retrievedList = testPool.GetPreferred(targets) + retrievedList = testPool.getPreferred(targets) if len(retrievedList) != len(targets) { t.Errorf("Requested list did not output requested length."+ "\n\tExpected: %d"+ @@ -567,8 +567,8 @@ func TestHostPool_ForceAdd(t *testing.T) { newGateways[i] = gwId } - // ForceAdd list of gateways - err = testPool.ForceAdd(newGateways) + // forceAdd list of gateways + err = testPool.forceAdd(newGateways) if err != nil { t.Errorf("Could not add gateways: %v", err) } @@ -648,7 +648,7 @@ func TestHostPool_UpdateConns_AddGateways(t *testing.T) { if err != nil { t.Errorf("Failed to marshal gateway id for %v", ndfGw) } - _, ok := testPool.GetSpecific(gwId) + _, ok := testPool.getSpecific(gwId) if !ok { t.Errorf("Failed to find gateway %v in manager", gwId) } diff --git a/network/gateway/sender.go b/network/gateway/sender.go index 5dcfb017d75bd52277311a830fcd82e0f8b273cc..08de8eeb56ceec4c7f1bb333622fef82a6d93501 100644 --- a/network/gateway/sender.go +++ b/network/gateway/sender.go @@ -18,12 +18,12 @@ import ( "io" ) -// Object used for sending that wraps the HostPool for providing destinations +// Sender Object used for sending that wraps the HostPool for providing destinations type Sender struct { *HostPool } -// Create a new Sender object wrapping a HostPool object +// NewSender Create a new Sender object wrapping a HostPool object func NewSender(poolParams PoolParams, rng io.Reader, ndf *ndf.NetworkDefinition, getter HostManager, storage *storage.Session, addGateway chan network.NodeGateway) (*Sender, error) { @@ -34,16 +34,15 @@ func NewSender(poolParams PoolParams, rng io.Reader, ndf *ndf.NetworkDefinition, return &Sender{hostPool}, nil } -// Call given sendFunc to a specific Host in the HostPool, +// SendToSpecific Call given sendFunc to a specific Host in the HostPool, // attempting with up to numProxies destinations in case of failure func (m *Sender) SendToSpecific(target *id.ID, sendFunc func(host *connect.Host, target *id.ID) (interface{}, error)) (interface{}, error) { - - host, ok := m.GetSpecific(target) + host, ok := m.getSpecific(target) if ok { result, err := sendFunc(host, target) if err == nil { - return result, m.ForceAdd([]*id.ID{host.GetId()}) + return result, m.forceAdd([]*id.ID{host.GetId()}) } } @@ -58,7 +57,7 @@ func (m *Sender) SendToSpecific(target *id.ID, return nil, errors.Errorf("Unable to send to any specifics with proxies") } -// Call given sendFunc to any Host in the HostPool, attempting with up to numProxies destinations +// SendToAny Call given sendFunc to any Host in the HostPool, attempting with up to numProxies destinations func (m *Sender) SendToAny(sendFunc func(host *connect.Host) (interface{}, error)) (interface{}, error) { proxies := m.getAny(m.poolParams.ProxyAttempts, nil) @@ -72,11 +71,11 @@ func (m *Sender) SendToAny(sendFunc func(host *connect.Host) (interface{}, error return nil, errors.Errorf("Unable to send to any proxies") } -// Call given sendFunc to any Host in the HostPool, attempting with up to numProxies destinations +// SendToPreferred Call given sendFunc to any Host in the HostPool, attempting with up to numProxies destinations func (m *Sender) SendToPreferred(targets []*id.ID, sendFunc func(host *connect.Host, target *id.ID) (interface{}, error)) (interface{}, error) { - targetHosts := m.GetPreferred(targets) + targetHosts := m.getPreferred(targets) for i, host := range targetHosts { result, err := sendFunc(host, targets[i]) if err == nil { diff --git a/network/manager.go b/network/manager.go index e8e75d149a015dda43fb7c17f20e8245c81d8c7f..b5201ce79d3810a987dc2801d5b6336930e1ac43 100644 --- a/network/manager.go +++ b/network/manager.go @@ -100,7 +100,6 @@ func NewManager(session *storage.Session, switchboard *switchboard.Switchboard, // Set up gateway.Sender poolParams := gateway.DefaultPoolParams() - poolParams.HostParams.MaxRetries = 3 m.sender, err = gateway.NewSender(poolParams, rng.GetStream(), ndf, comms, session, m.NodeRegistration) diff --git a/network/message/garbled_test.go b/network/message/garbled_test.go index 0f5c3a074641af02ef3e156372bd7957eedba5aa..f9609c60a25902009ece4161f082fd3523863f5d 100644 --- a/network/message/garbled_test.go +++ b/network/message/garbled_test.go @@ -4,6 +4,7 @@ import ( "encoding/binary" "gitlab.com/elixxir/client/interfaces/message" "gitlab.com/elixxir/client/interfaces/params" + "gitlab.com/elixxir/client/network/gateway" "gitlab.com/elixxir/client/network/internal" "gitlab.com/elixxir/client/network/message/parse" "gitlab.com/elixxir/client/storage" @@ -57,12 +58,18 @@ func TestManager_CheckGarbledMessages(t *testing.T) { Instance: nil, NodeRegistration: nil, } + p := gateway.DefaultPoolParams() + p.PoolSize = 1 + sender, err := gateway.NewSender(p, i.Rng.GetStream(), getNDF(), &MockSendCMIXComms{t: t}, i.Session, nil) + if err != nil { + t.Errorf(err.Error()) + } m := NewManager(i, params.Messages{ MessageReceptionBuffLen: 20, MessageReceptionWorkerPoolSize: 20, MaxChecksGarbledMessage: 20, GarbledMessageWait: time.Hour, - }, nil) + }, nil, sender) e2ekv := i.Session.E2e() err = e2ekv.AddPartner(sess2.GetUser().TransmissionID, sess2.E2e().GetDHPublicKey(), e2ekv.GetDHPrivateKey(), diff --git a/network/message/sendCmix_test.go b/network/message/sendCmix_test.go index 82b3ebcb2c3cfa87a72f62519f68541ae78bd06d..6d9e2ef2402ee651c50deb4e578e53b8715f3b6e 100644 --- a/network/message/sendCmix_test.go +++ b/network/message/sendCmix_test.go @@ -1,8 +1,10 @@ package message import ( + "github.com/pkg/errors" "gitlab.com/elixxir/client/interfaces/message" "gitlab.com/elixxir/client/interfaces/params" + "gitlab.com/elixxir/client/network/gateway" "gitlab.com/elixxir/client/network/internal" "gitlab.com/elixxir/client/storage" "gitlab.com/elixxir/client/switchboard" @@ -40,6 +42,16 @@ func (mc *MockSendCMIXComms) GetHost(hostId *id.ID) (*connect.Host, bool) { }) return h, true } + +func (mc *MockSendCMIXComms) AddHost(hid *id.ID, address string, cert []byte, params connect.HostParams) (host *connect.Host, err error) { + host, _ = mc.GetHost(nil) + return host, nil +} + +func (mc *MockSendCMIXComms) RemoveHost(hid *id.ID) { + +} + func (mc *MockSendCMIXComms) SendPutMessage(host *connect.Host, message *mixmessages.GatewaySlot) (*mixmessages.GatewaySlotResponse, error) { return &mixmessages.GatewaySlotResponse{ Accepted: true, @@ -115,24 +127,36 @@ func Test_attemptSendCmix(t *testing.T) { Instance: inst, NodeRegistration: nil, } + p := gateway.DefaultPoolParams() + p.PoolSize = 1 + sender, err := gateway.NewSender(p, i.Rng.GetStream(), getNDF(), &MockSendCMIXComms{t: t}, i.Session, nil) + if err != nil { + t.Errorf("%+v", errors.New(err.Error())) + return + } m := NewManager(i, params.Messages{ MessageReceptionBuffLen: 20, MessageReceptionWorkerPoolSize: 20, MaxChecksGarbledMessage: 20, GarbledMessageWait: time.Hour, - }, nil) + }, nil, sender) msgCmix := format.NewMessage(m.Session.Cmix().GetGroup().GetP().ByteLen()) msgCmix.SetContents([]byte("test")) e2e.SetUnencrypted(msgCmix, m.Session.User().GetCryptographicIdentity().GetTransmissionID()) - _, _, err = sendCmixHelper(msgCmix, sess2.GetUser().ReceptionID, params.GetDefaultCMIX(), + _, _, err = sendCmixHelper(sender, msgCmix, sess2.GetUser().ReceptionID, params.GetDefaultCMIX(), m.Instance, m.Session, m.nodeRegistration, m.Rng, m.TransmissionID, &MockSendCMIXComms{t: t}) if err != nil { t.Errorf("Failed to sendcmix: %+v", err) + panic("t") + return } } func getNDF() *ndf.NetworkDefinition { + nodeId := id.NewIdFromString("zezima", id.Node, &testing.T{}) + gwId := nodeId.DeepCopy() + gwId.SetType(id.Gateway) return &ndf.NetworkDefinition{ E2E: ndf.Group{ Prime: "E2EE983D031DC1DB6F1A7A67DF0E9A8E5561DB8E8D49413394C049B" + @@ -168,5 +192,19 @@ func getNDF() *ndf.NetworkDefinition { "BA9AE3F1DD2487199874393CD4D832186800654760E1E34C09E4D155179F9EC0" + "DC4473F996BDCE6EED1CABED8B6F116F7AD9CF505DF0F998E34AB27514B0FFE7", }, + Gateways: []ndf.Gateway{ + { + ID: gwId.Marshal(), + Address: "0.0.0.0", + TlsCertificate: "", + }, + }, + Nodes: []ndf.Node{ + { + ID: nodeId.Marshal(), + Address: "0.0.0.0", + TlsCertificate: "", + }, + }, } } diff --git a/network/rounds/historical.go b/network/rounds/historical.go index 1f9f85b57eeaee5b1867337b39d38e5875a21fbf..45aed7fdfaa7b296a46de79645e19fd010f88634 100644 --- a/network/rounds/historical.go +++ b/network/rounds/historical.go @@ -33,8 +33,8 @@ type historicalRoundsComms interface { //structure which contains a historical round lookup type historicalRoundRequest struct { - rid id.Round - identity reception.IdentityUse + rid id.Round + identity reception.IdentityUse numAttempts uint } @@ -96,7 +96,7 @@ func (m *Manager) processHistoricalRounds(comm historicalRoundsComms, quitCh <-c Rounds: rounds, } - result, err := m.sender.SendToAny(1, func(host *connect.Host) (interface{}, error) { + result, err := m.sender.SendToAny(func(host *connect.Host) (interface{}, error) { jww.DEBUG.Printf("Requesting Historical rounds %v from "+ "gateway %s", rounds, host.GetId()) return comm.RequestHistoricalRounds(host, hr) @@ -119,19 +119,19 @@ func (m *Manager) processHistoricalRounds(comm historicalRoundsComms, quitCh <-c // pick them up in the future. if roundInfo == nil { roundRequests[i].numAttempts++ - if roundRequests[i].numAttempts==m.params.MaxHistoricalRoundsRetries{ - jww.ERROR.Printf("Failed to retreive historical " + + if roundRequests[i].numAttempts == m.params.MaxHistoricalRoundsRetries { + jww.ERROR.Printf("Failed to retreive historical "+ "round %d on last attempt, will not try again", roundRequests[i].rid) - }else{ + } else { select { - case m.historicalRounds <-roundRequests[i]: - jww.WARN.Printf("Failed to retreive historical " + + case m.historicalRounds <- roundRequests[i]: + jww.WARN.Printf("Failed to retreive historical "+ "round %d, will try up to %d more times", roundRequests[i].rid, m.params.MaxHistoricalRoundsRetries-roundRequests[i].numAttempts) default: - jww.WARN.Printf("Failed to retreive historical " + - "round %d, failed to try again, round will not be " + + jww.WARN.Printf("Failed to retreive historical "+ + "round %d, failed to try again, round will not be "+ "retreived", roundRequests[i].rid) } } diff --git a/single/manager_test.go b/single/manager_test.go index a9718de7c884b0c7135d676c13672a5d97b78587..98bae2b6ec71b90a23aa53f72a01a10b5ab08963 100644 --- a/single/manager_test.go +++ b/single/manager_test.go @@ -15,6 +15,7 @@ import ( contact2 "gitlab.com/elixxir/client/interfaces/contact" "gitlab.com/elixxir/client/interfaces/message" "gitlab.com/elixxir/client/interfaces/params" + "gitlab.com/elixxir/client/network/gateway" "gitlab.com/elixxir/client/stoppable" "gitlab.com/elixxir/client/storage" "gitlab.com/elixxir/client/storage/reception" @@ -323,6 +324,10 @@ func (tnm *testNetworkManager) InProgressRegistrations() int { return 0 } +func (t *testNetworkManager) GetSender() *gateway.Sender { + return nil +} + func getNDF() *ndf.NetworkDefinition { return &ndf.NetworkDefinition{ E2E: ndf.Group{