mirror of
https://github.com/m1k1o/neko.git
synced 2024-07-24 14:40:50 +12:00
unify shutdown logs.
This commit is contained in:
parent
fd35254487
commit
7e2f173460
@ -30,7 +30,7 @@ func broadcastNew(pipelineStr string) *BroacastManagerCtx {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (manager *BroacastManagerCtx) shutdown() {
|
func (manager *BroacastManagerCtx) shutdown() {
|
||||||
manager.logger.Info().Msgf("shutting down")
|
manager.logger.Info().Msgf("shutdown")
|
||||||
|
|
||||||
manager.destroyPipeline()
|
manager.destroyPipeline()
|
||||||
}
|
}
|
||||||
|
@ -162,7 +162,7 @@ func (manager *CaptureManagerCtx) Start() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (manager *CaptureManagerCtx) Shutdown() error {
|
func (manager *CaptureManagerCtx) Shutdown() error {
|
||||||
manager.logger.Info().Msgf("capture shutting down")
|
manager.logger.Info().Msgf("shutdown")
|
||||||
|
|
||||||
manager.broadcast.shutdown()
|
manager.broadcast.shutdown()
|
||||||
manager.screencast.shutdown()
|
manager.screencast.shutdown()
|
||||||
|
@ -94,5 +94,7 @@ func (manager *HttpManagerCtx) Start() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (manager *HttpManagerCtx) Shutdown() error {
|
func (manager *HttpManagerCtx) Shutdown() error {
|
||||||
|
manager.logger.Info().Msg("shutdown")
|
||||||
|
|
||||||
return manager.http.Shutdown(context.Background())
|
return manager.http.Shutdown(context.Background())
|
||||||
}
|
}
|
||||||
|
@ -92,7 +92,7 @@ func (manager *WebRTCManagerCtx) Start() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (manager *WebRTCManagerCtx) Shutdown() error {
|
func (manager *WebRTCManagerCtx) Shutdown() error {
|
||||||
manager.logger.Info().Msg("webrtc shutdown")
|
manager.logger.Info().Msg("shutdown")
|
||||||
|
|
||||||
manager.curImage.Shutdown()
|
manager.curImage.Shutdown()
|
||||||
manager.curPosition.Shutdown()
|
manager.curPosition.Shutdown()
|
||||||
|
@ -131,7 +131,8 @@ func (manager *WebSocketManagerCtx) Start() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (manager *WebSocketManagerCtx) Shutdown() error {
|
func (manager *WebSocketManagerCtx) Shutdown() error {
|
||||||
manager.logger.Info().Msg("websocket shutdown")
|
manager.logger.Info().Msg("shutdown")
|
||||||
|
// TODO: Kill all connections and add waitgroup for gorutines.
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -178,10 +179,8 @@ func (manager *WebSocketManagerCtx) Upgrade(w http.ResponseWriter, r *http.Reque
|
|||||||
manager.logger.Err(err).Msg("failed to send disconnect event")
|
manager.logger.Err(err).Msg("failed to send disconnect event")
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := connection.Close(); err != nil {
|
err = connection.Close()
|
||||||
manager.logger.Warn().Err(err).Msg("connection closed with an error")
|
manager.logger.Err(err).Msg("connection closed")
|
||||||
}
|
|
||||||
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
2
neko.go
2
neko.go
@ -228,7 +228,7 @@ func (neko *Neko) ServeCommand(cmd *cobra.Command, args []string) {
|
|||||||
signal.Notify(quit, os.Interrupt)
|
signal.Notify(quit, os.Interrupt)
|
||||||
sig := <-quit
|
sig := <-quit
|
||||||
|
|
||||||
neko.logger.Warn().Msgf("received %s, attempting graceful shutdown: \n", sig)
|
neko.logger.Warn().Msgf("received %s, attempting graceful shutdown", sig)
|
||||||
neko.Shutdown()
|
neko.Shutdown()
|
||||||
neko.logger.Info().Msg("shutdown complete")
|
neko.logger.Info().Msg("shutdown complete")
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user