diff --git a/network/internal/internal.go b/network/internal/internal.go index 51b25214cb89e94cc10234488b6ea6010e8ed765..fc0d6aa429348b43469494b3136abc30c347e6da 100644 --- a/network/internal/internal.go +++ b/network/internal/internal.go @@ -28,8 +28,10 @@ type Internal struct { //contains the health tracker which keeps track of if from the client's //perspective, the network is in good condition Health *health.Tracker - //ID of the node - Uid *id.ID + //ID which messages are sent as + TransmissionID *id.ID + //ID which messages are received as + ReceptionID *id.ID //contains the network instance Instance *network.Instance diff --git a/network/manager.go b/network/manager.go index 686e2a60d064e494fe48a0462897979e9e874add..5839b66c458599b8573928d9bdd6d433163ea6c6 100644 --- a/network/manager.go +++ b/network/manager.go @@ -82,7 +82,8 @@ func NewManager(session *storage.Session, switchboard *switchboard.Switchboard, Health: health.Init(instance, params.NetworkHealthTimeout), NodeRegistration: make(chan network.NodeGateway, params.RegNodesBufferLen), Instance: instance, - Uid: session.User().GetCryptographicIdentity().GetTransmissionID(), + TransmissionID: session.User().GetCryptographicIdentity().GetTransmissionID(), + ReceptionID: session.User().GetCryptographicIdentity().GetReceptionID(), } //create sub managers @@ -133,7 +134,7 @@ func (m *manager) Follow() (stoppable.Stoppable, error) { // Round processing multi.Add(m.round.StartProcessors()) - multi.Add(ephemeral.Track(m.Session, m.Comms.Id)) + multi.Add(ephemeral.Track(m.Session, m.ReceptionID)) //set the running status back to 0 so it can be started again closer := stoppable.NewCleanup(multi, func(time.Duration) error { diff --git a/network/message/critical.go b/network/message/critical.go index cb29ae3f3b19b18c75815f86f3c3c9df326b69d6..5036bd5219e7aa8c4c166d83dbcc12c48ba14a68 100644 --- a/network/message/critical.go +++ b/network/message/critical.go @@ -85,7 +85,7 @@ func (m *Manager) criticalMessages() { for msg, has := critRawMsgs.Next(); has; msg, has = critRawMsgs.Next() { go func(msg format.Message) { //send the message - round, _, err := m.SendCMIX(msg, m.Uid, param) + round, _, err := m.SendCMIX(msg, m.TransmissionID, param) //if the message fail to send, notify the buffer so it can be handled //in the future and exit if err != nil { diff --git a/network/message/garbled_test.go b/network/message/garbled_test.go index e72a946e9ddf8e890f965104af079a9c74de1428..21098b72bef9a6408c6131c275c021471e79565d 100644 --- a/network/message/garbled_test.go +++ b/network/message/garbled_test.go @@ -52,7 +52,7 @@ func TestManager_CheckGarbledMessages(t *testing.T) { Rng: fastRNG.NewStreamGenerator(1, 1, csprng.NewSystemRNG), Comms: comms, Health: nil, - Uid: sess1.GetUser().TransmissionID, + TransmissionID: sess1.GetUser().TransmissionID, Instance: nil, NodeRegistration: nil, } diff --git a/network/message/sendCmix.go b/network/message/sendCmix.go index e03a4660c02b7797f9c1f4f666c4c0cb703a1ddc..5a884a59c1791f698e216b32611395397b46567f 100644 --- a/network/message/sendCmix.go +++ b/network/message/sendCmix.go @@ -37,7 +37,7 @@ const sendTimeBuffer = uint64(100 * time.Millisecond) // WARNING: Potentially Unsafe // Public manager function to send a message over CMIX func (m *Manager) SendCMIX(msg format.Message, recipient *id.ID, param params.CMIX) (id.Round, ephemeral.Id, error) { - return sendCmixHelper(msg, recipient, param, m.Instance, m.Session, m.nodeRegistration, m.Rng, m.Uid, m.Comms) + return sendCmixHelper(msg, recipient, param, m.Instance, m.Session, m.nodeRegistration, m.Rng, m.TransmissionID, m.Comms) } // Payloads send are not End to End encrypted, MetaData is NOT protected with diff --git a/network/message/sendCmix_test.go b/network/message/sendCmix_test.go index a623c77fa03842a62b3dddfb20a18b236bcceb22..2b8e7832615a81ead68e40d308cfd508cbf9ee20 100644 --- a/network/message/sendCmix_test.go +++ b/network/message/sendCmix_test.go @@ -89,7 +89,7 @@ func Test_attemptSendCmix(t *testing.T) { Rng: fastRNG.NewStreamGenerator(1, 1, csprng.NewSystemRNG), Comms: comms, Health: nil, - Uid: sess1.GetUser().TransmissionID, + TransmissionID: sess1.GetUser().TransmissionID, Instance: inst, NodeRegistration: nil, } @@ -104,7 +104,7 @@ func Test_attemptSendCmix(t *testing.T) { e2e.SetUnencrypted(msgCmix, m.Session.User().GetCryptographicIdentity().GetTransmissionID()) _, _, err = sendCmixHelper(msgCmix, sess2.GetUser().ReceptionID, params.GetDefaultCMIX(), m.Instance, m.Session, m.nodeRegistration, m.Rng, - m.Uid, &MockSendCMIXComms{t: t}) + m.TransmissionID, &MockSendCMIXComms{t: t}) if err != nil { t.Errorf("Failed to sendcmix: %+v", err) } diff --git a/network/rounds/retrieve.go b/network/rounds/retrieve.go index 05a03821118b95e7c34f984b24b4601ca9bb697c..8ef4755b5c2f8ab3d28ca7485b0792695d05a368 100644 --- a/network/rounds/retrieve.go +++ b/network/rounds/retrieve.go @@ -71,7 +71,7 @@ func (m *Manager) getMessagesFromGateway(roundInfo *pb.RoundInfo, // send the request msgReq := &pb.GetMessages{ - ClientID: m.Uid.Marshal(), + ClientID: m.TransmissionID.Marshal(), RoundID: uint64(rid), } msgResp, err := comms.RequestMessages(gwHost, msgReq) @@ -97,7 +97,7 @@ func (m *Manager) getMessagesFromGateway(roundInfo *pb.RoundInfo, jww.WARN.Printf("host %s has no messages for client %s "+ " in round %d. This happening every once in a while is normal,"+ " but can be indicitive of a problem if it is consistant", gwHost, - m.Uid, rid) + m.TransmissionID, rid) return message.Bundle{}, nil }