1
0
mirror of https://github.com/go-micro/go-micro.git synced 2025-08-10 21:52:01 +02:00

Some router changes

This commit is contained in:
Asim Aslam
2019-01-07 17:17:06 +00:00
parent 46ece968d4
commit c717af21ac
2 changed files with 28 additions and 20 deletions

View File

@@ -107,7 +107,7 @@ func (s *rpcServer) accept(sock transport.Socket) {
}
// TODO: needs better error handling
if err := s.router.serveRequest(ctx, codec, ct); err != nil {
if err := s.router.ServeRequest(ctx, codec, ct); err != nil {
s.wg.Done()
log.Logf("Unexpected error serving request, closing socket: %v", err)
return
@@ -149,14 +149,14 @@ func (s *rpcServer) Init(opts ...Option) error {
}
func (s *rpcServer) NewHandler(h interface{}, opts ...HandlerOption) Handler {
return newRpcHandler(h, opts...)
return s.router.NewHandler(h, opts...)
}
func (s *rpcServer) Handle(h Handler) error {
s.Lock()
defer s.Unlock()
if err := s.router.register(h.Handler()); err != nil {
if err := s.router.Handle(h); err != nil {
return err
}