mirror of
https://github.com/etcd-io/etcd.git
synced 2024-09-27 06:25:44 +00:00
etcdhttp: set peer should clean up previous values
This commit is contained in:
parent
9215ebb6aa
commit
5c8839387d
@ -39,7 +39,8 @@ func (ps Peers) Pick(id int64) string {
|
||||
|
||||
// Set parses command line sets of names to ips formatted like:
|
||||
// a=1.1.1.1&a=1.1.1.2&b=2.2.2.2
|
||||
func (ps Peers) Set(s string) error {
|
||||
func (ps *Peers) Set(s string) error {
|
||||
m := make(map[int64][]string)
|
||||
v, err := url.ParseQuery(s)
|
||||
if err != nil {
|
||||
return err
|
||||
@ -49,12 +50,13 @@ func (ps Peers) Set(s string) error {
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
ps[id] = v
|
||||
m[id] = v
|
||||
}
|
||||
*ps = m
|
||||
return nil
|
||||
}
|
||||
|
||||
func (ps Peers) String() string {
|
||||
func (ps *Peers) String() string {
|
||||
return "todo"
|
||||
}
|
||||
|
||||
|
5
main.go
5
main.go
@ -27,7 +27,8 @@ var (
|
||||
timeout = flag.Duration("timeout", 10*time.Second, "Request Timeout")
|
||||
laddr = flag.String("l", ":8080", "HTTP service address (e.g., ':8080')")
|
||||
dir = flag.String("data-dir", "", "Path to the data directory")
|
||||
peers = etcdhttp.Peers{}
|
||||
|
||||
peers = &etcdhttp.Peers{}
|
||||
)
|
||||
|
||||
func init() {
|
||||
@ -62,7 +63,7 @@ func main() {
|
||||
Store: store.New(),
|
||||
Node: n,
|
||||
Save: w.Save,
|
||||
Send: etcdhttp.Sender(peers),
|
||||
Send: etcdhttp.Sender(*peers),
|
||||
Ticker: tk.C,
|
||||
}
|
||||
etcdserver.Start(s)
|
||||
|
Loading…
x
Reference in New Issue
Block a user