Skip to content

Commit

Permalink
handle the scheme correctly in config.Bind
Browse files Browse the repository at this point in the history
  • Loading branch information
travisturner committed Feb 23, 2018
1 parent 359fc19 commit 3d1538d
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
13 changes: 8 additions & 5 deletions gossip/gossip.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ import (
"io"
"io/ioutil"
"log"
"net"
"os"
"strconv"
"strings"
Expand Down Expand Up @@ -154,10 +153,12 @@ func NewGossipMemberSetWithTransport(name string, cfg *pilosa.Config, transport
}

port := transport.Net.GetAutoBindPort()
host, _, err := net.SplitHostPort(cfg.Bind)

bindURI, err := pilosa.NewURIFromAddress(cfg.Bind)
if err != nil {
return nil, fmt.Errorf("split host port: %s", err)
return nil, fmt.Errorf("getting uri from bind address (with transport): %s", err)
}
host := bindURI.Host()

var gossipKey []byte
if cfg.Gossip.Key != "" {
Expand Down Expand Up @@ -210,10 +211,12 @@ func NewGossipMemberSet(name string, cfg *pilosa.Config, server *pilosa.Server)
if err != nil {
return nil, fmt.Errorf("convert port: %s", err)
}
host, _, err := net.SplitHostPort(cfg.Bind)

bindURI, err := pilosa.NewURIFromAddress(cfg.Bind)
if err != nil {
return nil, fmt.Errorf("split host port: %s", err)
return nil, fmt.Errorf("getting uri from bind address: %s", err)
}
host := bindURI.Host()

// Set up the transport.
transport, err := NewTransport(host, port)
Expand Down
2 changes: 1 addition & 1 deletion test/pilosa.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ func NewMain() *Main {
m := &Main{Command: server.NewCommand(os.Stdin, os.Stdout, os.Stderr)}
m.Server.Network = *Network
m.Config.DataDir = path
m.Config.Bind = "localhost:0"
m.Config.Bind = "http://localhost:0"
m.Config.Cluster.Disabled = true
m.Command.Stdin = &m.Stdin
m.Command.Stdout = &m.Stdout
Expand Down

0 comments on commit 3d1538d

Please sign in to comment.