More consistent use of signal struct
This commit is contained in:
parent
cb09125dc4
commit
eaca1ee1f7
9 changed files with 68 additions and 68 deletions
11
src/main.go
11
src/main.go
|
|
@ -8,6 +8,10 @@ import (
|
|||
"strconv"
|
||||
)
|
||||
|
||||
import _ "net/http/pprof"
|
||||
import "net/http"
|
||||
import "log"
|
||||
|
||||
const (
|
||||
ExitSetupSuccess = 0
|
||||
ExitSetupFailed = 1
|
||||
|
|
@ -25,6 +29,10 @@ func printUsage() {
|
|||
|
||||
func main() {
|
||||
|
||||
go func() {
|
||||
log.Println(http.ListenAndServe("localhost:6060", nil))
|
||||
}()
|
||||
|
||||
// parse arguments
|
||||
|
||||
var foreground bool
|
||||
|
|
@ -160,7 +168,6 @@ func main() {
|
|||
|
||||
errs := make(chan error)
|
||||
term := make(chan os.Signal)
|
||||
wait := device.WaitChannel()
|
||||
|
||||
uapi, err := UAPIListen(interfaceName, fileUAPI)
|
||||
|
||||
|
|
@ -183,9 +190,9 @@ func main() {
|
|||
signal.Notify(term, os.Interrupt)
|
||||
|
||||
select {
|
||||
case <-wait:
|
||||
case <-term:
|
||||
case <-errs:
|
||||
case <-device.Wait():
|
||||
}
|
||||
|
||||
// clean up
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue