summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorFUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>2017-02-02 00:56:29 -0800
committerFUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>2017-02-02 00:56:29 -0800
commita7456d5aab36b04163da30ceb91ff69d6f223426 (patch)
tree3c7b61808a3fdc396c21cdfabedeef0abc6944be
parent7336d9d54fb013c1760ce18b6c1594746ca4b469 (diff)
server: fix rpki server state
Needs to update the state before copying it. Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
-rw-r--r--server/rpki.go18
1 files changed, 9 insertions, 9 deletions
diff --git a/server/rpki.go b/server/rpki.go
index 1d95642b..9e81d360 100644
--- a/server/rpki.go
+++ b/server/rpki.go
@@ -432,15 +432,6 @@ func (c *roaManager) GetServers() []*config.RpkiServer {
for _, client := range c.clientMap {
state := &client.state
- addr, port, _ := net.SplitHostPort(client.host)
- l = append(l, &config.RpkiServer{
- Config: config.RpkiServerConfig{
- Address: addr,
- Port: func() uint32 { p, _ := strconv.Atoi(port); return uint32(p) }(),
- },
- State: client.state,
- })
-
if client.conn == nil {
state.Up = false
} else {
@@ -457,6 +448,15 @@ func (c *roaManager) GetServers() []*config.RpkiServer {
state.PrefixesV4 = f(prefixesV4, client.host)
state.PrefixesV6 = f(prefixesV6, client.host)
state.SerialNumber = client.serialNumber
+
+ addr, port, _ := net.SplitHostPort(client.host)
+ l = append(l, &config.RpkiServer{
+ Config: config.RpkiServerConfig{
+ Address: addr,
+ Port: func() uint32 { p, _ := strconv.Atoi(port); return uint32(p) }(),
+ },
+ State: client.state,
+ })
}
return l
}