This commit is contained in:
Héctor Hurtado
2020-04-06 18:02:29 +02:00
parent 73ef493f04
commit e6e25f25c7
5 changed files with 56 additions and 18 deletions
+14 -2
View File
@@ -18,10 +18,22 @@ package control
import (
"log"
"net"
"net/http"
"sync"
)
// Run Starts the control server listening in bindAddr
func Run(bindAddr string) {
log.Fatal(http.ListenAndServe(bindAddr, configRouter()))
func Run(bindAddr string, wg *sync.WaitGroup) {
listener, err := net.Listen("tcp", bindAddr)
if err != nil {
log.Fatal(err)
}
// Signal startup
log.Printf("ControlServer listening at %s\n", bindAddr)
wg.Done()
log.Fatal(http.Serve(listener, configRouter()))
}