From f5fe854a632bf778c3b6d04c298fe92a64a1f9b6 Mon Sep 17 00:00:00 2001 From: Valery Piashchynski Date: Tue, 20 Oct 2020 16:52:55 +0300 Subject: Update RpcService registration --- plugins/rpc/rpc.go | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'plugins/rpc') diff --git a/plugins/rpc/rpc.go b/plugins/rpc/rpc.go index bd3e3b2e..6568eea3 100644 --- a/plugins/rpc/rpc.go +++ b/plugins/rpc/rpc.go @@ -79,14 +79,13 @@ func (s *Service) Serve() chan error { errCh <- err return errCh } - defer func() { - errCh <- ln.Close() - }() go func() { for { select { case <-s.close: + // log error + errCh <- ln.Close() return default: conn, err := ln.Accept() @@ -115,8 +114,13 @@ func (s *Service) Depends() []interface{} { } func (s *Service) RpcService(p PluginRpc) error { + service, err := p.RpcService() + if err != nil { + return err + } + s.services = append(s.services, services{ - service: p.RpcService(), + service: service, name: p.Name(), }) return nil -- cgit v1.2.3