set pointers to nil

This commit is contained in:
Cedric Verstraeten
2023-02-18 22:14:33 +01:00
parent 7671b1c2c3
commit a2bea93267
+6
View File
@@ -214,10 +214,14 @@ func RunAgent(configuration *models.Configuration, communication *models.Communi
time.Sleep(time.Second * 1)
infile.Close()
infile = nil
queue.Close()
queue = nil
if subStreamEnabled {
subInfile.Close()
subInfile = nil
subQueue.Close()
subQueue = nil
}
close(communication.HandleONVIF)
close(communication.HandleLiveHDHandshake)
@@ -227,8 +231,10 @@ func RunAgent(configuration *models.Configuration, communication *models.Communi
// Wait a few seconds to stop the decoder.
time.Sleep(time.Second * 3)
decoder.Close()
decoder = nil
if subStreamEnabled {
subDecoder.Close()
subDecoder = nil
}
// Waiting for some seconds to make sure everything is properly closed.
log.Log.Info("RunAgent: waiting 3 seconds to make sure everything is properly closed.")