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

forced a disconnect after a round in a super hacky way for a test.

parent 2ebe1506
No related branches found
No related tags found
No related merge requests found
...@@ -17,6 +17,7 @@ import ( ...@@ -17,6 +17,7 @@ import (
"gitlab.com/elixxir/server/internal" "gitlab.com/elixxir/server/internal"
"gitlab.com/elixxir/server/internal/measure" "gitlab.com/elixxir/server/internal/measure"
"gitlab.com/elixxir/server/internal/phase" "gitlab.com/elixxir/server/internal/phase"
"gitlab.com/elixxir/server/permissioning"
"gitlab.com/xx_network/comms/connect" "gitlab.com/xx_network/comms/connect"
"gitlab.com/xx_network/primitives/id" "gitlab.com/xx_network/primitives/id"
"time" "time"
...@@ -65,14 +66,14 @@ func ReceiveFinishRealtime(instance *internal.Instance, msg *mixmessages.RoundIn ...@@ -65,14 +66,14 @@ func ReceiveFinishRealtime(instance *internal.Instance, msg *mixmessages.RoundIn
p.Measure(measure.TagVerification) p.Measure(measure.TagVerification)
go func() { go func() {
p.UpdateFinalStates() p.UpdateFinalStates()
/*if !r.GetTopology().IsFirstNode(instance.GetID()) { if !r.GetTopology().IsFirstNode(instance.GetID()) {
// Disconnect from all hosts that are not "you" // Disconnect from all hosts that are not "you"
for i := 0; i < r.GetTopology().Len(); i++ { for i := 0; i < r.GetTopology().Len(); i++ {
if !r.GetTopology().GetNodeAtIndex(i).Cmp(instance.GetID()) { if !r.GetTopology().GetNodeAtIndex(i).Cmp(instance.GetID()) {
r.GetTopology().GetHostAtIndex(i).Disconnect() permissioning.HostList = append(permissioning.HostList, r.GetTopology().GetHostAtIndex(i))
}
} }
} }
}*/
if !instance.GetKeepBuffers() { if !instance.GetKeepBuffers() {
//Delete the round and its data from the manager //Delete the round and its data from the manager
//Delay so it can be used by post round hanlders //Delay so it can be used by post round hanlders
......
...@@ -71,10 +71,22 @@ func RegisterNode(def *internal.Definition, instance *internal.Instance, permHos ...@@ -71,10 +71,22 @@ func RegisterNode(def *internal.Definition, instance *internal.Instance, permHos
return nil return nil
} }
var HostList []*connect.Host
var waitAndDisconnect bool
// Poll is used to retrieve updated state information from permissioning // Poll is used to retrieve updated state information from permissioning
// and update our internal state accordingly // and update our internal state accordingly
func Poll(instance *internal.Instance) error { func Poll(instance *internal.Instance) error {
if waitAndDisconnect {
time.Sleep(10 * time.Second)
for _, host := range HostList {
host.Disconnect()
}
waitAndDisconnect = false
HostList = make([]*connect.Host, 0)
}
// Fetch the host information from the network // Fetch the host information from the network
permHost, ok := instance.GetNetwork().GetHost(&id.Permissioning) permHost, ok := instance.GetNetwork().GetHost(&id.Permissioning)
if !ok { if !ok {
...@@ -98,6 +110,7 @@ func Poll(instance *internal.Instance) error { ...@@ -98,6 +110,7 @@ func Poll(instance *internal.Instance) error {
// Once done and in a completed state, manually switch back into waiting // Once done and in a completed state, manually switch back into waiting
if reportedActivity == current.COMPLETED { if reportedActivity == current.COMPLETED {
waitAndDisconnect = true
ok, err := instance.GetStateMachine().Update(current.WAITING) ok, err := instance.GetStateMachine().Update(current.WAITING)
if err != nil || !ok { if err != nil || !ok {
return errors.Errorf("Could not transition to WAITING state: %v", err) return errors.Errorf("Could not transition to WAITING state: %v", err)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment