|
|
@@ -29,7 +29,7 @@ type program struct {
|
|
|
name string
|
|
|
core_server *jsonrpc2.RPCServer
|
|
|
http_server *http.Server
|
|
|
- http_done chan struct{}
|
|
|
+ done chan struct{}
|
|
|
}
|
|
|
|
|
|
// Start should not block. Do the actual work async.
|
|
|
@@ -80,7 +80,7 @@ func (p *program) Start(s service.Service) error {
|
|
|
Handler: mux,
|
|
|
}
|
|
|
|
|
|
- p.http_done = make(chan struct{})
|
|
|
+ p.done = make(chan struct{})
|
|
|
|
|
|
go p.run()
|
|
|
|
|
|
@@ -89,7 +89,7 @@ func (p *program) Start(s service.Service) error {
|
|
|
|
|
|
// Do work here
|
|
|
func (p *program) run() {
|
|
|
- defer close(p.http_done)
|
|
|
+ defer close(p.done)
|
|
|
|
|
|
err := p.http_server.ListenAndServe() // 同步阻塞
|
|
|
|
|
|
@@ -112,8 +112,8 @@ func (p *program) Stop(s service.Service) error {
|
|
|
_ = p.http_server.Shutdown(ctx)
|
|
|
}
|
|
|
|
|
|
- if p.http_done != nil {
|
|
|
- <-p.http_done
|
|
|
+ if p.done != nil {
|
|
|
+ <-p.done
|
|
|
}
|
|
|
|
|
|
netmgrd.ModemExit()
|