mirror of
https://github.com/linka-cloud/grpc.git
synced 2024-12-22 08:50:46 +00:00
service: add Serve method
Signed-off-by: Adphi <philippe.adrien.nousse@gmail.com>
This commit is contained in:
parent
97f48d30c0
commit
f455c9994c
@ -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()
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user