Close session pro-actively during clear all session

This commit is contained in:
Harshavardhana
2015-08-25 14:21:33 -07:00
parent 16e0c86a6b
commit 1ce6f7cbc7
+7 -1
View File
@@ -188,7 +188,13 @@ func (s *sessionV2) Delete() *probe.Error {
defer s.mutex.Unlock()
if s.DataFP != nil {
err := os.Remove(s.DataFP.Name())
name := s.DataFP.Name()
// close file pro-actively before deleting
// ignore any error, it could be possibly that
// the file is closed already
s.DataFP.Close()
err := os.Remove(name)
if err != nil {
return probe.NewError(err)
}