diff --git a/network/message/critical.go b/network/message/critical.go index 0ba2fa1e2360a8e904c23b27a1605cc0b0224a27..800c93ef7b692150fed9bbf72ac01c3eae56f108 100644 --- a/network/message/critical.go +++ b/network/message/critical.go @@ -50,17 +50,19 @@ func (m *Manager) criticalMessages() { //critical messages for msg, param, has := critMsgs.Next(); has; msg, param, has = critMsgs.Next() { go func(msg message.Send, param params.E2E) { + jww.INFO.Printf("Resending critical message to %s ", + msg.Recipient) //send the message rounds, _, err := m.SendE2E(msg, param) //if the message fail to send, notify the buffer so it can be handled //in the future and exit if err != nil { - jww.ERROR.Printf("Failed to send critical message on "+ - "notification of healthy network: %+v", err) + jww.ERROR.Printf("Failed to send critical message to %s " + + " on notification of healthy network: %+v", msg.Recipient, + err) critMsgs.Failed(msg) return } - jww.INFO.Printf("critical RoundIDs: %v", rounds) //wait on the results to make sure the rounds were successful sendResults := make(chan ds.EventReturn, len(rounds)) roundEvents := m.Instance.GetRoundEvents() @@ -70,12 +72,16 @@ func (m *Manager) criticalMessages() { } success, numTimeOut, numRoundFail := utility.TrackResults(sendResults, len(rounds)) if !success { - jww.ERROR.Printf("critical message send failed to transmit "+ - "transmit %v/%v paritions: %v round failures, %v timeouts", - numRoundFail+numTimeOut, len(rounds), numRoundFail, numTimeOut) + jww.ERROR.Printf("critical message send to %s failed " + + "to transmit transmit %v/%v paritions on rounds %d: %v " + + "round failures, %v timeouts", msg.Recipient, + numRoundFail+numTimeOut, len(rounds), rounds, numRoundFail, numTimeOut) critMsgs.Failed(msg) return } + + jww.INFO.Printf("Sucesfull resend of critical message " + + "to %s on rounds %d", msg.Recipient, rounds) critMsgs.Succeeded(msg) }(msg, param) } @@ -86,33 +92,45 @@ func (m *Manager) criticalMessages() { for msg, rid, has := critRawMsgs.Next(); has; msg, rid, has = critRawMsgs.Next() { localRid := rid.DeepCopy() go func(msg format.Message, rid *id.ID) { + jww.INFO.Printf("Resending critical raw message to %s " + + "(msgDigest: %s)", rid, msg.Digest()) //send the message round, _, err := m.SendCMIX(msg, rid, param) //if the message fail to send, notify the buffer so it can be handled //in the future and exit if err != nil { - jww.ERROR.Printf("Failed to send critical message on "+ + jww.ERROR.Printf("Failed to send critical raw message on "+ "notification of healthy network: %+v", err) critRawMsgs.Failed(msg, rid) return } - jww.INFO.Printf("critical healthy RoundIDs: %v", round) - //wait on the results to make sure the rounds were sucesfull + //wait on the results to make sure the rounds were successful sendResults := make(chan ds.EventReturn, 1) roundEvents := m.Instance.GetRoundEvents() roundEvents.AddRoundEventChan(round, sendResults, 1*time.Minute, states.COMPLETED, states.FAILED) - success, numTimeOut, numRoundFail := utility.TrackResults(sendResults, 1) + success, numTimeOut, _ := utility.TrackResults(sendResults, 1) if !success { - jww.ERROR.Printf("critical message send failed to transmit "+ - "transmit %v/%v paritions: %v round failures, %v timeouts", - numRoundFail+numTimeOut, 1, numRoundFail, numTimeOut) + if numTimeOut>0{ + jww.ERROR.Printf("critical raw message resend to %s " + + "(msgDigest: %s) on round %d failed to transmit due to " + + "timeout", rid, msg.Digest(), round) + }else{ + jww.ERROR.Printf("critical raw message resend to %s " + + "(msgDigest: %s) on round %d failed to transmit due to " + + "send failure", rid, msg.Digest(), round) + } + critRawMsgs.Failed(msg, rid) return } + + jww.INFO.Printf("Sucesfull resend of critical raw message " + + "to %s (msgDigest: %s) on round %d", rid, msg.Digest(), round) + critRawMsgs.Succeeded(msg, rid) }(msg, localRid) } diff --git a/network/message/garbled.go b/network/message/garbled.go index 6ae13f50ee2409ac7ca43e81bc3645985e0b2c07..b8b10bf2b60d29b7fbc2c77f8500e4fa98863d44 100644 --- a/network/message/garbled.go +++ b/network/message/garbled.go @@ -11,6 +11,7 @@ import ( "gitlab.com/elixxir/client/interfaces/message" "gitlab.com/elixxir/primitives/format" "time" + jww "github.com/spf13/jwalterweatherman" ) // Messages can arrive in the network out of order. When message handling fails @@ -59,6 +60,10 @@ func (m *Manager) handleGarbledMessages() { sender := key.GetSession().GetPartner() //remove from the buffer if decryption is successful garbledMsgs.Remove(grbldMsg) + + jww.INFO.Printf("Garbled message decoded as E2E from " + + "%s, msgDigest: %s", sender, grbldMsg.Digest()) + //handle the successfully decrypted message xxMsg, ok := m.partitioner.HandlePartition(sender, message.E2E, msg.GetContents(), diff --git a/ud/addFact.go b/ud/addFact.go index 41d3e8451a00ca8635f4bac31c7625c22cc82b4e..a32668f7179d1282f7f96438f13f76905e8b2b8f 100644 --- a/ud/addFact.go +++ b/ud/addFact.go @@ -26,8 +26,7 @@ type addFactComms interface { // called along with the code to finalize the fact. func (m *Manager) SendRegisterFact(fact fact.Fact) (string, error) { jww.INFO.Printf("ud.SendRegisterFact(%s)", fact.Stringify()) - uid := m.storage.User().GetCryptographicIdentity().GetReceptionID() - return m.addFact(fact, uid, m.comms) + return m.addFact(fact, m.myID, m.comms) } func (m *Manager) addFact(inFact fact.Fact, uid *id.ID, aFC addFactComms) (string, error) { diff --git a/ud/manager.go b/ud/manager.go index ad7519969b1c6c136c6c562565abcfa6038f7e22..08f67f821b367175157b88ba4a7cc0b22124f6de 100644 --- a/ud/manager.go +++ b/ud/manager.go @@ -38,9 +38,11 @@ type Manager struct { privKey *rsa.PrivateKey grp *cyclic.Group - // Internal maps + // internal structures host *connect.Host single SingleInterface + myID *id.ID + registered *uint32 } @@ -94,6 +96,8 @@ func NewManager(client *api.Client, single *single.Manager) (*Manager, error) { "not be constructed.") } + m.myID = m.storage.User().GetCryptographicIdentity().GetReceptionID() + // Get the commonly used data from storage m.privKey = m.storage.GetUser().ReceptionRSA diff --git a/ud/remove.go b/ud/remove.go index d46b8b872e96e7edf333015a6efaa2f4eaaa1be5..44c4a03dc8de6b432aa828549f8535f9fa620b29 100644 --- a/ud/remove.go +++ b/ud/remove.go @@ -35,7 +35,7 @@ func (m *Manager) removeFact(fact fact.Fact, rFC removeFactComms) error { // Create our Fact Removal Request message data remFactMsg := mixmessages.FactRemovalRequest{ - UID: m.storage.GetUser().GetContact().ID.Marshal(), + UID: m.myID.Marshal(), RemovalData: &mmFact, } diff --git a/ud/remove_test.go b/ud/remove_test.go index cedc4a53c8a947eafef5a0c6440f8c5ebdc72dd9..c8c46b9013eca3524c7f5ef4ee92275e0bef4761 100644 --- a/ud/remove_test.go +++ b/ud/remove_test.go @@ -36,6 +36,7 @@ func TestRemoveFact(t *testing.T) { host: h, privKey: cpk, registered: &isReg, + myID: &id.ID{}, } f := fact.Fact{