Skip to content
Snippets Groups Projects
Commit ac7d31b8 authored by Richard T. Carback III's avatar Richard T. Carback III
Browse files

Merge remote-tracking branch 'origin/release' into hotfix/nodereg

parents 0306eeaa df63239b
Branches
Tags
No related merge requests found
......@@ -21,6 +21,8 @@ type Network struct {
// Longest delay between network events for Health tracker to denote that
// the network is in a bad state
NetworkHealthTimeout time.Duration
//Number of parallel node registration the client is capable of
ParallelNodeRegistrations uint
Rounds
Messages
......@@ -36,6 +38,7 @@ func GetDefaultNetwork() Network {
RegNodesBufferLen: 500,
NetworkHealthTimeout: 30 * time.Second,
E2EParams: GetDefaultE2ESessionParams(),
ParallelNodeRegistrations: 8,
}
n.Rounds = GetDefaultRounds()
n.Messages = GetDefaultMessage()
......
......@@ -91,6 +91,10 @@ func NewManager(session *storage.Session, switchboard *switchboard.Switchboard,
ReceptionID: session.User().GetCryptographicIdentity().GetReceptionID(),
}
// register the node registration channel early so login connection updates
// get triggered for registration if necessary
instance.SetAddGatewayChan(m.NodeRegistration)
//create sub managers
m.message = message.NewManager(m.Internal, m.param.Messages, m.NodeRegistration)
m.round = rounds.NewManager(m.Internal, m.param.Rounds, m.message.GetMessageReceptionChannel())
......@@ -124,7 +128,7 @@ func (m *manager) Follow(report interfaces.ClientErrorReport) (stoppable.Stoppab
// Node Updates
multi.Add(node.StartRegistration(m.Instance, m.Session, m.Rng,
m.Comms, m.NodeRegistration)) // Adding/Keys
m.Comms, m.NodeRegistration, m.param.ParallelNodeRegistrations)) // Adding/Keys
//TODO-remover
//m.runners.Add(StartNodeRemover(m.Context)) // Removing
......
......@@ -41,14 +41,18 @@ type RegisterNodeCommsInterface interface {
}
func StartRegistration(instance *network.Instance, session *storage.Session, rngGen *fastRNG.StreamGenerator, comms RegisterNodeCommsInterface,
c chan network.NodeGateway) stoppable.Stoppable {
stop := stoppable.NewSingle("NodeRegistration")
c chan network.NodeGateway, numParallel uint) stoppable.Stoppable {
instance.SetAddGatewayChan(c)
multi := stoppable.NewMulti("NodeRegistrations")
for i:=uint(0);i<numParallel;i++{
stop := stoppable.NewSingle(fmt.Sprintf("NodeRegistration %d", i))
go registerNodes(session, rngGen, comms, stop, c)
multi.Add(stop)
}
return stop
return multi
}
func registerNodes(session *storage.Session, rngGen *fastRNG.StreamGenerator, comms RegisterNodeCommsInterface,
......@@ -74,7 +78,6 @@ func registerNodes(session *storage.Session, rngGen *fastRNG.StreamGenerator, co
case <-t.C:
}
}
}
//registerWithNode serves as a helper for RegisterWithNodes
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment