diff options
Diffstat (limited to 'pkg/server/grpc_server.go')
-rw-r--r-- | pkg/server/grpc_server.go | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/pkg/server/grpc_server.go b/pkg/server/grpc_server.go index 2d25734a..1ae58055 100644 --- a/pkg/server/grpc_server.go +++ b/pkg/server/grpc_server.go @@ -102,6 +102,18 @@ func (s *server) serve() error { return nil } +func (s *server) ListPeerGroup(r *api.ListPeerGroupRequest, stream api.GobgpApi_ListPeerGroupServer) error { + ctx, cancel := context.WithCancel(context.Background()) + defer cancel() + fn := func(pg *api.PeerGroup) { + if err := stream.Send(&api.ListPeerGroupResponse{PeerGroup: pg}); err != nil { + cancel() + return + } + } + return s.bgpServer.ListPeerGroup(ctx, r, fn) +} + func parseHost(host string) (string, string) { const unixScheme = "unix://" if strings.HasPrefix(host, unixScheme) { |