Fixes #1197 Protecting concurrent access to cdre

This commit is contained in:
Krzysztof Grzyb
2018-09-12 10:17:16 +02:00
committed by Dan Christian Bogos
parent 3a5d2aa932
commit 3759993f99
2 changed files with 3 additions and 0 deletions

View File

@@ -68,6 +68,7 @@ information, please see the [`CONTRIBUTING.md`](CONTRIBUTING.md) file.
| @petekelly | Peter Kelly |
| @vtzan | Vasilios Tzanoudakis |
| @ccppprogrammer | Sergei Lavrov |
| @chrisgis333 | Krzysztof Grzyb |
<!-- to sign, include a single line above this comment containing the following text:
| @username | First Last |

View File

@@ -331,6 +331,8 @@ func (cdre *CDRExporter) processCDR(cdr *CDR) (err error) {
return
}
// Done with writing content, compute stats here
cdre.Lock()
defer cdre.Unlock()
if cdre.firstCdrATime.IsZero() || cdr.AnswerTime.Before(cdre.firstCdrATime) {
cdre.firstCdrATime = cdr.AnswerTime
}