mirror of
https://github.com/etcd-io/etcd.git
synced 2024-09-27 06:25:44 +00:00
etcd-tester: fix peer-port parsing bug with localhost url
The following format "http://localhost:1234" causes existing port parser to fail. Add new logic to parse the host name first then extract port. Fixes #6409
This commit is contained in:
@@ -168,7 +168,11 @@ func (m *member) grpcAddr() string {
|
||||
}
|
||||
|
||||
func (m *member) peerPort() (port int) {
|
||||
_, portStr, err := net.SplitHostPort(m.PeerURL)
|
||||
u, err := url.Parse(m.PeerURL)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
_, portStr, err := net.SplitHostPort(u.Host)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user