summaryrefslogtreecommitdiffhomepage
path: root/api/grpc_server.go
diff options
context:
space:
mode:
authorChris Stockton <cstockton@godaddy.com>2016-10-04 15:03:44 -0700
committerChris Stockton <cstockton@godaddy.com>2016-10-04 15:03:44 -0700
commit60ebbb99b44b46060b1831366ebe6c0aa7d992ec (patch)
treee2ff0ad37c8d7b9918a036dd5c113500857531a2 /api/grpc_server.go
parentebd7306fd6d996cdc95cf3f73cc728477f63d780 (diff)
Allow creating a server with a user specified grpc server.
Diffstat (limited to 'api/grpc_server.go')
-rw-r--r--api/grpc_server.go9
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
}