mirror of
https://github.com/wneessen/logranger.git
synced 2024-11-22 12:50:50 +01:00
Refactor signal handling and remove SPDX licensing details
Redid signal handling in the main server code leading to simpler, more readable code. Removed the SPDX license identifiers from 'go.sum' following recent policy changes.
This commit is contained in:
parent
ea1ac393bc
commit
436df7b2b4
2 changed files with 21 additions and 28 deletions
|
@ -45,12 +45,10 @@ func main() {
|
||||||
|
|
||||||
sc := make(chan os.Signal, 1)
|
sc := make(chan os.Signal, 1)
|
||||||
signal.Notify(sc)
|
signal.Notify(sc)
|
||||||
for {
|
for rc := range sc {
|
||||||
select {
|
|
||||||
case rc := <-sc:
|
|
||||||
if rc == syscall.SIGKILL || rc == syscall.SIGABRT || rc == syscall.SIGINT || rc == syscall.SIGTERM {
|
if rc == syscall.SIGKILL || rc == syscall.SIGABRT || rc == syscall.SIGINT || rc == syscall.SIGTERM {
|
||||||
l.Warn("received signal. shutting down server", slog.String("signal", rc.String()))
|
l.Warn("received signal. shutting down server", slog.String("signal", rc.String()))
|
||||||
//s.Stop()
|
// s.Stop()
|
||||||
l.Info("server gracefully shut down")
|
l.Info("server gracefully shut down")
|
||||||
os.Exit(0)
|
os.Exit(0)
|
||||||
}
|
}
|
||||||
|
@ -71,5 +69,4 @@ func main() {
|
||||||
*/
|
*/
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
4
go.sum
4
go.sum
|
@ -1,7 +1,3 @@
|
||||||
// SPDX-FileCopyrightText: 2023 Winni Neessen <wn@neessen.dev>
|
|
||||||
//
|
|
||||||
// SPDX-License-Identifier: MIT
|
|
||||||
|
|
||||||
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||||
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
|
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
|
||||||
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||||
|
|
Loading…
Reference in a new issue