diff options
author | Chris Stockton <cstockton@godaddy.com> | 2016-10-04 15:03:44 -0700 |
---|---|---|
committer | Chris Stockton <cstockton@godaddy.com> | 2016-10-04 15:03:44 -0700 |
commit | 60ebbb99b44b46060b1831366ebe6c0aa7d992ec (patch) | |
tree | e2ff0ad37c8d7b9918a036dd5c113500857531a2 | |
parent | ebd7306fd6d996cdc95cf3f73cc728477f63d780 (diff) |
Allow creating a server with a user specified grpc server.
-rw-r--r-- | api/grpc_server.go | 9 |
1 files 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 } |