summaryrefslogtreecommitdiffhomepage
path: root/server
diff options
context:
space:
mode:
authorFUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>2015-07-28 14:56:17 +0900
committerFUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>2015-07-28 14:56:17 +0900
commit941786a05891c68519582125117a203207365af8 (patch)
tree2388f793dab3b2266f47d0622f6f6a22fb736e15 /server
parent427e9efa79b3cac87a5628698ef0662088fd856a (diff)
server: fix one-shot mrt dump
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Diffstat (limited to 'server')
-rw-r--r--server/server.go8
1 files changed, 6 insertions, 2 deletions
diff --git a/server/server.go b/server/server.go
index dfc7058a..0b958af9 100644
--- a/server/server.go
+++ b/server/server.go
@@ -58,10 +58,14 @@ type broadcastMsg interface {
type broadcastGrpcMsg struct {
req *GrpcRequest
result *GrpcResponse
+ done bool
}
func (m *broadcastGrpcMsg) send() {
m.req.ResponseCh <- m.result
+ if m.done == true {
+ close(m.req.ResponseCh)
+ }
}
type BgpServer struct {
@@ -1964,7 +1968,6 @@ func (server *BgpServer) handleMrt(grpcReq *GrpcRequest) {
req: grpcReq,
result: result,
}
- server.broadcastMsgs = append(server.broadcastMsgs, m)
interval := int64(grpcReq.Data.(uint64))
if interval > 0 {
@@ -1974,8 +1977,9 @@ func (server *BgpServer) handleMrt(grpcReq *GrpcRequest) {
server.GrpcReqCh <- grpcReq
}()
} else {
- close(grpcReq.ResponseCh)
+ m.done = true
}
+ server.broadcastMsgs = append(server.broadcastMsgs, m)
return
}