mirror of
https://github.com/linka-cloud/grpc.git
synced 2024-11-22 02:46:25 +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
|
Options() Options
|
||||||
Start() error
|
Start() error
|
||||||
|
Serve(lis net.Listener) error
|
||||||
Stop() error
|
Stop() error
|
||||||
Close() 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 {
|
func (s *service) Start() error {
|
||||||
return s.run()
|
return s.run()
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user