Commit e7b142c6 authored by Jordan Sissel's avatar Jordan Sissel

- pick a server at random when connecting

parent 08515b5b
package main
import (
"math/rand"
"bytes"
"encoding/binary"
"encoding/pem"
......@@ -133,8 +134,11 @@ func connect(config *NetworkConfig) (socket *tls.Conn) {
tlsconfig.RootCAs.AddCert(cert)
}
address := "127.0.0.1:3333"
for {
// Pick a random server from the list.
address := config.Servers[rand.Int() % len(config.Servers)]
log.Printf("Connecting to %s\n", address)
tcpsocket, err := net.DialTimeout("tcp", address, config.Timeout)
if err != nil {
log.Printf("Failure connecting to %s: %s\n", address, 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