From f455c9994c30517dc506c4c3fccabba967e6f78e Mon Sep 17 00:00:00 2001 From: Adphi Date: Fri, 25 Aug 2023 17:15:52 +0200 Subject: [PATCH] service: add Serve method Signed-off-by: Adphi --- service/service.go | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/service/service.go b/service/service.go index 6de532f..dd7bee8 100644 --- a/service/service.go +++ b/service/service.go @@ -37,6 +37,7 @@ type Service interface { Options() Options Start() error + Serve(lis net.Listener) error Stop() error Close() error } @@ -267,6 +268,13 @@ func (s *service) run() error { } } +func (s *service) Serve(lis net.Listener) error { + s.mu.Lock() + s.opts.lis = lis + s.mu.Unlock() + return s.run() +} + func (s *service) Start() error { return s.run() }