Closing channel when http server dies

Fixing deadlock on error
master
Frederick F. Kautz IV 10 years ago
parent 3f03ce7334
commit 2ede0bff52
  1. 1
      pkg/httpserver/httpserver.go
  2. 2
      pkg/server/server.go

@ -16,4 +16,5 @@ func start(ctrlChannel <-chan string, errorChannel chan<- error, router http.Han
log.Println("Starting HTTP Server")
err := http.ListenAndServe(":8080", router)
errorChannel <- err
close(errorChannel)
}

@ -27,7 +27,7 @@ func Start() {
cases := createSelectCases(statusChans)
for {
for len(cases) > 0 {
chosen, value, recvOk := reflect.Select(cases)
if recvOk == true {
// Status Message Received

Loading…
Cancel
Save