Commit 7912b83d authored by masala's avatar masala

select random authority

parent 04902006
......@@ -22,7 +22,6 @@ import (
"context"
"errors"
"fmt"
//mrand "math/rand"
"net"
"github.com/katzenpost/authority/internal/s11n"
......@@ -209,13 +208,14 @@ func (p *connector) allPeersRoundTrip(ctx context.Context, linkKey *ecdh.Private
func (p *connector) randomPeerRoundTrip(ctx context.Context, linkKey *ecdh.PrivateKey, cmd commands.Command) (commands.Command, error) {
doneCh := make(chan interface{})
defer close(doneCh)
//peerIndex := mrand.Intn(len(p.cfg.Authorities) - 1)
peerIndex := 0
if len(p.cfg.Authorities) == 0 {
return nil, errors.New("error: zero Authorities specified in configuration")
}
r := rand.NewMath()
peerIndex := r.Intn(len(p.cfg.Authorities))
conn, err := p.initSession(ctx, doneCh, linkKey, nil, p.cfg.Authorities[peerIndex])
if err != nil {
return nil, err
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment