diff --git a/interfaces/utility/trackResults.go b/interfaces/utility/trackResults.go index 70b5e43f4d762aba8b99957b6b7e1efb4d852695..cd766624d475141edbad94731f3a3da092e4bcfd 100644 --- a/interfaces/utility/trackResults.go +++ b/interfaces/utility/trackResults.go @@ -26,5 +26,5 @@ func TrackResults(resultsCh chan ds.EventReturn, numResults int) (bool, int, int } } - return (numTimeOut + numRoundFail) > 0, numRoundFail, numTimeOut + return (numTimeOut + numRoundFail) == 0, numRoundFail, numTimeOut } diff --git a/keyExchange/utils_test.go b/keyExchange/utils_test.go index c11728b1afd66ace0983fce8dcf2134978f35150..bda05f0b822888261f8f61f460840536dd9ddbc5 100644 --- a/keyExchange/utils_test.go +++ b/keyExchange/utils_test.go @@ -101,11 +101,7 @@ func (t *testNetworkManagerGeneric) GetStoppable() stoppable.Stoppable { func InitTestingContextGeneric(i interface{}) (*storage.Session, interfaces.NetworkManager) { switch i.(type) { - case *testing.T: - break - case *testing.M: - break - case *testing.B: + case *testing.T, *testing.M, *testing.B, *testing.PB: break default: globals.Log.FATAL.Panicf("InitTestingSession is restricted to testing only. Got %T", i) @@ -208,11 +204,7 @@ func (t *testNetworkManagerFullExchange) GetStoppable() stoppable.Stoppable { func InitTestingContextFullExchange(i interface{}) (*storage.Session, *switchboard.Switchboard, interfaces.NetworkManager) { switch i.(type) { - case *testing.T: - break - case *testing.M: - break - case *testing.B: + case *testing.T, *testing.M, *testing.B, *testing.PB: break default: globals.Log.FATAL.Panicf("InitTestingSession is restricted to testing only. Got %T", i) diff --git a/network/ephemeral/tracker.go b/network/ephemeral/tracker.go index 07985b841fbf4a06e901b4a9b911020300e54399..51052437b3490e7d0124855af7b5143446c11793 100644 --- a/network/ephemeral/tracker.go +++ b/network/ephemeral/tracker.go @@ -64,10 +64,10 @@ func track(session *storage.Session, ourId *id.ID, stop *stoppable.Single) { protoIds, err := ephemeral.GetIdsByRange(ourId, receptionStore.GetIDSize(), now, now.Sub(lastCheck)) - jww.INFO.Printf("Now: %d, LastCheck: %v (%v), Different: %v (%v)", + jww.DEBUG.Printf("Now: %d, LastCheck: %v (%v), Different: %v (%v)", now.UnixNano(), lastCheck, lastCheck, now.Sub(lastCheck), now.Sub(lastCheck)) - jww.INFO.Printf("protoIds Count: %d", len(protoIds)) + jww.DEBUG.Printf("protoIds Count: %d", len(protoIds)) if err != nil { jww.FATAL.Panicf("Could not generate "+ @@ -80,6 +80,10 @@ func track(session *storage.Session, ourId *id.ID, stop *stoppable.Single) { jww.INFO.Printf("Number of Identities Generated: %d", len(identities)) + jww.INFO.Printf("Current Identity: %d (source: %s), Start: %s, End: %s", + identities[len(identities)-1].EphId.Int64(), identities[len(identities)-1].Source, + identities[len(identities)-1].StartValid, identities[len(identities)-1].EndValid) + // Add identities to storage if unique for _, identity := range identities { // Track if identity has been generated already @@ -147,7 +151,9 @@ func generateIdentities(protoIds []ephemeral.ProtoIdentity, // then the current time is stored func checkTimestampStore(session *storage.Session) error { if _, err := session.Get(TimestampKey); err != nil { - now, err := marshalTimestamp(time.Unix(0, 0)) + // only generate from the last hour because this is a new id, it + // couldn't receive messages yet + now, err := marshalTimestamp(time.Now().Add(-1*time.Hour)) if err != nil { return errors.Errorf("Could not marshal new timestamp for storage: %v", err) } diff --git a/network/message/sendCmix.go b/network/message/sendCmix.go index 0dae64e7e44a34da225414f2e5737f053ab20819..e03a4660c02b7797f9c1f4f666c4c0cb703a1ddc 100644 --- a/network/message/sendCmix.go +++ b/network/message/sendCmix.go @@ -85,6 +85,8 @@ func sendCmixHelper(msg format.Message, recipient *id.ID, param params.CMIX, ins jww.FATAL.Panicf("Failed to generate ephemeral ID: %+v", err) } + jww.INFO.Printf("Sending to EphID %v (source: %s)", ephID.Int64(), recipient) + stream := rng.GetStream() ephID, err = ephID.Fill(uint(bestRound.AddressSpaceSize), stream) if err != nil { diff --git a/storage/e2e/session.go b/storage/e2e/session.go index 43eacbf80f676c1eeefbab5adcb395b31cbcd08a..78997dc00d7e78ca1b5badb5d82ef6e676837f7a 100644 --- a/storage/e2e/session.go +++ b/storage/e2e/session.go @@ -243,11 +243,7 @@ func getSessionIDFromBaseKey(baseKey *cyclic.Int) SessionID { // FOR TESTING PURPOSES ONLY func GetSessionIDFromBaseKeyForTesting(baseKey *cyclic.Int, i interface{}) SessionID { switch i.(type) { - case *testing.T: - break - case *testing.M: - break - case *testing.B: + case *testing.T, *testing.M, *testing.B, *testing.PB: break default: globals.Log.FATAL.Panicf("GetSessionIDFromBaseKeyForTesting is restricted to testing only. Got %T", i) diff --git a/storage/session.go b/storage/session.go index 8f276039df5eae534421f57008921d2e90852749..ab8d23d99ef05f114fa3f17b5b0333bf2906d682 100644 --- a/storage/session.go +++ b/storage/session.go @@ -290,11 +290,7 @@ func (s *Session) Delete(key string) error { // FOR TESTING ONLY func InitTestingSession(i interface{}) *Session { switch i.(type) { - case *testing.T: - break - case *testing.M: - break - case *testing.B: + case *testing.T, *testing.M, *testing.B, *testing.PB: break default: globals.Log.FATAL.Panicf("InitTestingSession is restricted to testing only. Got %T", i) diff --git a/ud/confirmFact.go b/ud/confirmFact.go index b715a620d19af1c3f3cdb9f4c25599334f70c277..a625e7e6337d8facc4cff7096d078ee53b264a7d 100644 --- a/ud/confirmFact.go +++ b/ud/confirmFact.go @@ -2,10 +2,10 @@ package ud import ( "github.com/pkg/errors" + jww "github.com/spf13/jwalterweatherman" pb "gitlab.com/elixxir/comms/mixmessages" "gitlab.com/xx_network/comms/connect" "gitlab.com/xx_network/comms/messages" - jww "github.com/spf13/jwalterweatherman" ) type confirmFactComm interface { @@ -16,14 +16,14 @@ type confirmFactComm interface { // AddFact while the code will come over the associated communications system func (m *Manager) SendConfirmFact(confirmationID, code string) error { jww.INFO.Printf("ud.SendConfirmFact(%s, %s)", confirmationID, code) - if err := m.confirmFact(confirmationID, code, m.comms); err!=nil{ + if err := m.confirmFact(confirmationID, code, m.comms); err != nil { return errors.WithMessage(err, "Failed to confirm fact") } return nil } func (m *Manager) confirmFact(confirmationID, code string, comm confirmFactComm) error { - if !m.IsRegistered(){ + if !m.IsRegistered() { return errors.New("Failed to confirm fact: " + "client is not registered") } diff --git a/ud/remove.go b/ud/remove.go index d679a1abd479230ae2baa9e6dc59a6d49c07fcd5..966609c6e2f8c26ad0f3478356e03b1f462bf02f 100644 --- a/ud/remove.go +++ b/ud/remove.go @@ -2,11 +2,11 @@ package ud import ( "github.com/pkg/errors" + jww "github.com/spf13/jwalterweatherman" "gitlab.com/elixxir/comms/mixmessages" "gitlab.com/elixxir/primitives/fact" "gitlab.com/xx_network/comms/connect" "gitlab.com/xx_network/comms/messages" - jww "github.com/spf13/jwalterweatherman" ) type removeFactComms interface { @@ -21,7 +21,7 @@ func (m *Manager) RemoveFact(fact fact.Fact) error { } func (m *Manager) removeFact(fact fact.Fact, rFC removeFactComms) error { - if !m.IsRegistered(){ + if !m.IsRegistered() { return errors.New("Failed to remove fact: " + "client is not registered") }