Skip to content
Snippets Groups Projects
Commit a0e433d8 authored by Benjamin Wenger's avatar Benjamin Wenger
Browse files

fixed so that known rounds are unique per user identity

parent fee15cdf
Branches
Tags
No related merge requests found
...@@ -229,12 +229,9 @@ func (m *manager) follow(rng csprng.Source, comms followNetworkComms) { ...@@ -229,12 +229,9 @@ func (m *manager) follow(rng csprng.Source, comms followNetworkComms) {
return m.round.Checker(rid, filterList, identity) return m.round.Checker(rid, filterList, identity)
} }
// get the bit vector of rounds that have been checked
checkedRounds := m.Session.GetCheckedRounds()
// loop through all rounds the client does not know about and the gateway // loop through all rounds the client does not know about and the gateway
// does, checking the bloom filter for the user to see if there are // does, checking the bloom filter for the user to see if there are
// messages for the user (bloom not implemented yet) // messages for the user (bloom not implemented yet)
checkedRounds.RangeUncheckedMaskedRange(gwRoundsState, roundChecker, identity.KR.RangeUncheckedMaskedRange(gwRoundsState, roundChecker,
firstRound, lastRound+1, int(m.param.MaxCheckedRounds)) firstRound, lastRound+1, int(m.param.MaxCheckedRounds))
} }
...@@ -17,7 +17,6 @@ import ( ...@@ -17,7 +17,6 @@ import (
"gitlab.com/elixxir/primitives/format" "gitlab.com/elixxir/primitives/format"
"gitlab.com/xx_network/comms/connect" "gitlab.com/xx_network/comms/connect"
"gitlab.com/xx_network/primitives/id" "gitlab.com/xx_network/primitives/id"
"gitlab.com/xx_network/primitives/id/ephemeral"
) )
type messageRetrievalComms interface { type messageRetrievalComms interface {
...@@ -41,7 +40,7 @@ func (m *Manager) processMessageRetrieval(comms messageRetrievalComms, ...@@ -41,7 +40,7 @@ func (m *Manager) processMessageRetrieval(comms messageRetrievalComms,
done = true done = true
case rl := <-m.lookupRoundMessages: case rl := <-m.lookupRoundMessages:
ri := rl.roundInfo ri := rl.roundInfo
bundle, err := m.getMessagesFromGateway(ri, comms, rl.identity.EphId) bundle, err := m.getMessagesFromGateway(ri, comms, rl.identity)
if err != nil { if err != nil {
jww.WARN.Printf("Failed to get messages for round %v: %s", jww.WARN.Printf("Failed to get messages for round %v: %s",
ri.ID, err) ri.ID, err)
...@@ -57,7 +56,7 @@ func (m *Manager) processMessageRetrieval(comms messageRetrievalComms, ...@@ -57,7 +56,7 @@ func (m *Manager) processMessageRetrieval(comms messageRetrievalComms,
} }
func (m *Manager) getMessagesFromGateway(roundInfo *pb.RoundInfo, func (m *Manager) getMessagesFromGateway(roundInfo *pb.RoundInfo,
comms messageRetrievalComms, ephid ephemeral.Id) (message.Bundle, error) { comms messageRetrievalComms, identity reception.IdentityUse) (message.Bundle, error) {
rid := id.Round(roundInfo.ID) rid := id.Round(roundInfo.ID)
...@@ -69,11 +68,11 @@ func (m *Manager) getMessagesFromGateway(roundInfo *pb.RoundInfo, ...@@ -69,11 +68,11 @@ func (m *Manager) getMessagesFromGateway(roundInfo *pb.RoundInfo,
} }
jww.INFO.Printf("Getting messages for RoundID %v for EphID %d " + jww.INFO.Printf("Getting messages for RoundID %v for EphID %d " +
"via Gateway: %s", rid, ephid, gwHost.GetId()) "via Gateway: %s", rid, identity.EphId, gwHost.GetId())
// send the request // send the request
msgReq := &pb.GetMessages{ msgReq := &pb.GetMessages{
ClientID: ephid[:], ClientID: identity.EphId[:],
RoundID: uint64(rid), RoundID: uint64(rid),
} }
msgResp, err := comms.RequestMessages(gwHost, msgReq) msgResp, err := comms.RequestMessages(gwHost, msgReq)
...@@ -87,7 +86,7 @@ func (m *Manager) getMessagesFromGateway(roundInfo *pb.RoundInfo, ...@@ -87,7 +86,7 @@ func (m *Manager) getMessagesFromGateway(roundInfo *pb.RoundInfo,
if !msgResp.GetHasRound() { if !msgResp.GetHasRound() {
rid := id.Round(roundInfo.ID) rid := id.Round(roundInfo.ID)
m.p.Done(rid) m.p.Done(rid)
m.Session.GetCheckedRounds().Check(rid) identity.KR.Check(rid)
return message.Bundle{}, errors.Errorf("host %s does not have "+ return message.Bundle{}, errors.Errorf("host %s does not have "+
"roundID: %d", gwHost.String(), rid) "roundID: %d", gwHost.String(), rid)
} }
...@@ -111,7 +110,7 @@ func (m *Manager) getMessagesFromGateway(roundInfo *pb.RoundInfo, ...@@ -111,7 +110,7 @@ func (m *Manager) getMessagesFromGateway(roundInfo *pb.RoundInfo,
Round: rid, Round: rid,
Messages: make([]format.Message, len(msgs)), Messages: make([]format.Message, len(msgs)),
Finish: func() { Finish: func() {
m.Session.GetCheckedRounds().Check(rid) identity.KR.Check(rid)
m.p.Done(rid) m.p.Done(rid)
}, },
} }
......
...@@ -25,7 +25,6 @@ import ( ...@@ -25,7 +25,6 @@ import (
"gitlab.com/elixxir/crypto/cyclic" "gitlab.com/elixxir/crypto/cyclic"
"gitlab.com/elixxir/crypto/fastRNG" "gitlab.com/elixxir/crypto/fastRNG"
"gitlab.com/elixxir/ekv" "gitlab.com/elixxir/ekv"
"gitlab.com/elixxir/primitives/knownRounds"
"gitlab.com/xx_network/crypto/csprng" "gitlab.com/xx_network/crypto/csprng"
"gitlab.com/xx_network/crypto/large" "gitlab.com/xx_network/crypto/large"
"gitlab.com/xx_network/crypto/signature/rsa" "gitlab.com/xx_network/crypto/signature/rsa"
...@@ -57,7 +56,6 @@ type Session struct { ...@@ -57,7 +56,6 @@ type Session struct {
criticalMessages *utility.E2eMessageBuffer criticalMessages *utility.E2eMessageBuffer
criticalRawMessages *utility.CmixMessageBuffer criticalRawMessages *utility.CmixMessageBuffer
garbledMessages *utility.MeteredCmixMessageBuffer garbledMessages *utility.MeteredCmixMessageBuffer
checkedRounds *utility.KnownRounds
reception *reception.Store reception *reception.Store
} }
...@@ -129,11 +127,6 @@ func New(baseDir, password string, u userInterface.User, cmixGrp, ...@@ -129,11 +127,6 @@ func New(baseDir, password string, u userInterface.User, cmixGrp,
return nil, errors.WithMessage(err, "Failed to create raw critical message buffer") return nil, errors.WithMessage(err, "Failed to create raw critical message buffer")
} }
s.checkedRounds, err = utility.NewKnownRounds(s.kv, checkedRoundsKey, knownRounds.NewKnownRound(CheckRoundsMaxSize))
if err != nil {
return nil, errors.WithMessage(err, "Failed to create checked rounds buffer")
}
s.conversations = conversation.NewStore(s.kv) s.conversations = conversation.NewStore(s.kv)
s.partition = partition.New(s.kv) s.partition = partition.New(s.kv)
...@@ -192,11 +185,6 @@ func Load(baseDir, password string, rng *fastRNG.StreamGenerator) (*Session, err ...@@ -192,11 +185,6 @@ func Load(baseDir, password string, rng *fastRNG.StreamGenerator) (*Session, err
return nil, errors.WithMessage(err, "Failed to load session") return nil, errors.WithMessage(err, "Failed to load session")
} }
s.checkedRounds, err = utility.LoadKnownRounds(s.kv, checkedRoundsKey, CheckRoundsMaxSize)
if err != nil {
return nil, errors.WithMessage(err, "Failed to load session")
}
s.conversations = conversation.NewStore(s.kv) s.conversations = conversation.NewStore(s.kv)
s.partition = partition.New(s.kv) s.partition = partition.New(s.kv)
...@@ -253,12 +241,6 @@ func (s *Session) GetGarbledMessages() *utility.MeteredCmixMessageBuffer { ...@@ -253,12 +241,6 @@ func (s *Session) GetGarbledMessages() *utility.MeteredCmixMessageBuffer {
return s.garbledMessages return s.garbledMessages
} }
func (s *Session) GetCheckedRounds() *utility.KnownRounds {
s.mux.RLock()
defer s.mux.RUnlock()
return s.checkedRounds
}
func (s *Session) Conversations() *conversation.Store { func (s *Session) Conversations() *conversation.Store {
s.mux.RLock() s.mux.RLock()
defer s.mux.RUnlock() defer s.mux.RUnlock()
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment