From 60ebbb99b44b46060b1831366ebe6c0aa7d992ec Mon Sep 17 00:00:00 2001 From: Chris Stockton Date: Tue, 4 Oct 2016 15:03:44 -0700 Subject: Allow creating a server with a user specified grpc server. --- api/grpc_server.go | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/api/grpc_server.go b/api/grpc_server.go index 7d96a14f..2d194393 100644 --- a/api/grpc_server.go +++ b/api/grpc_server.go @@ -41,14 +41,17 @@ type Server struct { } func NewGrpcServer(b *server.BgpServer, hosts string) *Server { + return NewServer(b, grpc.NewServer(), hosts) +} + +func NewServer(b *server.BgpServer, g *grpc.Server, hosts string) *Server { grpc.EnableTracing = false - grpcServer := grpc.NewServer() server := &Server{ bgpServer: b, - grpcServer: grpcServer, + grpcServer: g, hosts: hosts, } - RegisterGobgpApiServer(grpcServer, server) + RegisterGobgpApiServer(g, server) return server } -- cgit v1.2.3