diff options
Diffstat (limited to 'server/server.go')
-rw-r--r-- | server/server.go | 8 |
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 } |