Skip to content

Commit

Permalink
Depend on grpc server rather than create one from options
Browse files Browse the repository at this point in the history
This should allow us to share the network interface for both servers
  • Loading branch information
LLKennedy committed Nov 16, 2019
1 parent 38ea334 commit d74cb1e
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions proxy/setup.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,16 @@ import (
// NewServer creates a proxy from HTTP(S) traffic to server using the methods defined by api
// api should be the Unimplemented<ServiceName> struct compiled by the protobuf. All methods defined on api MUST start with an HTTP method name
// server MUST implement the same methods as api without the prepended method names, though it may have others without exposing them to HTTP(S) traffic
func NewServer(api, server interface{}, opt ...grpc.ServerOption) (*Server, error) {
func NewServer(api, server interface{}, listener *grpc.Server) (*Server, error) {
s := new(Server)
s.register(opt...)
s.register(listener)
return s, s.setAPIConfig(api, server)
}

// register registers the server
func (s *Server) register(opt ...grpc.ServerOption) {
s.setGrpcServer(grpc.NewServer(opt...))
httpgrpc.RegisterExposedServiceServer(s.grpcServer, s)
func (s *Server) register(listener *grpc.Server) {
s.setGrpcServer(listener)
httpgrpc.RegisterExposedServiceServer(s.getGrpcServer(), s)
}

// setAPIConfig validates and sets the inner api and endpoint config
Expand Down

0 comments on commit d74cb1e

Please sign in to comment.