Skip to content
Snippets Groups Projects
Commit dc4fe083 authored by Jake Taylor's avatar Jake Taylor
Browse files

attempt to fix GetRoundResults by making the follower only send one RoundEvent...

attempt to fix GetRoundResults by making the follower only send one RoundEvent per completed/failed round
parent 0d7c0df7
No related branches found
No related tags found
2 merge requests!170Release,!144attempt to fix GetRoundResults by making the follower only send one RoundEvent...
...@@ -223,24 +223,8 @@ func (m *manager) follow(report interfaces.ClientErrorReport, rng csprng.Source, ...@@ -223,24 +223,8 @@ func (m *manager) follow(report interfaces.ClientErrorReport, rng csprng.Source,
} }
} }
// Update the address space size // NOTE: this updates rounds and updates the tracking of the health of the network
// todo: this is a fix for incompatibility with the live network
// remove once the live network has been pushed to
if len(m.Instance.GetPartialNdf().Get().AddressSpace) != 0 {
m.addrSpace.Update(m.Instance.GetPartialNdf().Get().AddressSpace[0].Size)
} else {
m.addrSpace.Update(18)
}
// NOTE: this updates rounds and updates the tracking of the health of the
// network
if pollResp.Updates != nil { if pollResp.Updates != nil {
err = m.Instance.RoundUpdates(pollResp.Updates)
if err != nil {
jww.ERROR.Printf("%+v", err)
return
}
// TODO: ClientErr needs to know the source of the error and it doesn't yet // TODO: ClientErr needs to know the source of the error and it doesn't yet
// Iterate over ClientErrors for each RoundUpdate // Iterate over ClientErrors for each RoundUpdate
for _, update := range pollResp.Updates { for _, update := range pollResp.Updates {
...@@ -266,19 +250,11 @@ func (m *manager) follow(report interfaces.ClientErrorReport, rng csprng.Source, ...@@ -266,19 +250,11 @@ func (m *manager) follow(report interfaces.ClientErrorReport, rng csprng.Source,
return return
} }
// Mutate the update to indicate failure due to a ClientError
// FIXME: Should be able to trigger proper type of round event // FIXME: Should be able to trigger proper type of round event
// FIXME: without mutating the RoundInfo. Signature also needs verified // FIXME: without mutating the RoundInfo. Signature also needs verified
// FIXME: before keys are deleted // FIXME: before keys are deleted
update.State = uint32(states.FAILED) update.State = uint32(states.FAILED)
rnd, err := m.Instance.GetWrappedRound(id.Round(update.ID))
if err != nil {
jww.ERROR.Printf("Failed to report client error: "+
"Could not get round for event triggering: "+
"Unable to get round %d from instance: %+v",
id.Round(update.ID), err)
break
}
m.Instance.GetRoundEvents().TriggerRoundEvent(rnd)
// delete all existing keys and trigger a re-registration with the relevant Node // delete all existing keys and trigger a re-registration with the relevant Node
m.Session.Cmix().Remove(nid) m.Session.Cmix().Remove(nid)
...@@ -287,6 +263,13 @@ func (m *manager) follow(report interfaces.ClientErrorReport, rng csprng.Source, ...@@ -287,6 +263,13 @@ func (m *manager) follow(report interfaces.ClientErrorReport, rng csprng.Source,
} }
} }
// Trigger RoundEvents for all polled updates, including modified rounds with ClientErrors
err = m.Instance.RoundUpdates(pollResp.Updates)
if err != nil {
jww.ERROR.Printf("%+v", err)
return
}
newestTS := uint64(0) newestTS := uint64(0)
for i := 0; i < len(pollResp.Updates[len(pollResp.Updates)-1].Timestamps); i++ { for i := 0; i < len(pollResp.Updates[len(pollResp.Updates)-1].Timestamps); i++ {
if pollResp.Updates[len(pollResp.Updates)-1].Timestamps[i] != 0 { if pollResp.Updates[len(pollResp.Updates)-1].Timestamps[i] != 0 {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment