M main.go => main.go +1 -0
@@ 106,6 106,7 @@ func bootstrap() {
logger.Info("ENTER has been pressed; closing election")
n := len(me.otherVoters)
closeElection <- n
+ close(closeElection)
for _, voter := range me.otherVoters {
stream, err := me.h.NewStream(me.ctx, voter.ID, protocolID)
if err != nil {
M voter.go => voter.go +1 -0
@@ 63,6 63,7 @@ func handleCmd(cmd string, rw *bufio.ReadWriter, stream network.Stream) {
panic(err)
}
closeElection <- numPeers
+ close(closeElection)
electionClosed = true
case "shake":
p := stream.Conn().RemotePeer()