From 31b6cad47b2076ba7384b62649d280d9cdd8892b Mon Sep 17 00:00:00 2001 From: Asim Aslam Date: Mon, 4 Feb 2019 10:29:10 +0000 Subject: [PATCH] make copy before writing --- server/rpc_server.go | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/server/rpc_server.go b/server/rpc_server.go index de3b8fd3..fa8aed43 100644 --- a/server/rpc_server.go +++ b/server/rpc_server.go @@ -274,12 +274,18 @@ func (s *rpcServer) Register() error { return err } + // make copy of metadata + md := make(metadata.Metadata) + for k, v := range config.Metadata { + md[k] = v + } + // register service node := ®istry.Node{ Id: config.Name + "-" + config.Id, Address: addr, Port: port, - Metadata: config.Metadata, + Metadata: md, } node.Metadata["transport"] = config.Transport.String()