mirror of
https://github.com/netbirdio/netbird.git
synced 2025-01-19 04:19:48 +01:00
Fix exit signal handling
This commit is contained in:
parent
3bd820f2e4
commit
7633cca3b1
@ -166,11 +166,13 @@ func execute(cmd *cobra.Command, args []string) error {
|
|||||||
return fmt.Errorf("failed to create relay server: %v", err)
|
return fmt.Errorf("failed to create relay server: %v", err)
|
||||||
}
|
}
|
||||||
log.Infof("server will be available on: %s", srv.InstanceURL())
|
log.Infof("server will be available on: %s", srv.InstanceURL())
|
||||||
err = srv.Listen(srvListenerCfg)
|
go func() {
|
||||||
if err != nil {
|
if err := srv.Listen(srvListenerCfg); err != nil {
|
||||||
return fmt.Errorf("failed to bind server: %s", err)
|
log.Errorf("failed to bind server: %s", err)
|
||||||
}
|
}
|
||||||
|
}()
|
||||||
|
|
||||||
|
// it will block until exit signal
|
||||||
waitForExitSignal()
|
waitForExitSignal()
|
||||||
|
|
||||||
err = srv.Close()
|
err = srv.Close()
|
||||||
|
@ -38,7 +38,6 @@ func (l *Listener) Listen(acceptFn func(conn net.Conn)) error {
|
|||||||
var err error
|
var err error
|
||||||
if l.TLSConfig != nil {
|
if l.TLSConfig != nil {
|
||||||
err = l.server.ListenAndServeTLS("", "")
|
err = l.server.ListenAndServeTLS("", "")
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
err = l.server.ListenAndServe()
|
err = l.server.ListenAndServe()
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user