service: add Serve method

Signed-off-by: Adphi <philippe.adrien.nousse@gmail.com>
This commit is contained in:
Adphi 2023-08-25 17:15:52 +02:00
parent 97f48d30c0
commit f455c9994c
Signed by: adphi
GPG Key ID: 46BE4062DB2397FF
1 changed files with 8 additions and 0 deletions

View File

@ -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()
}