xAdded lock around the use of OnuOmciStateMap to prevent a concurrent map write issue.
I considered using a structure like sync.Map or other concurrency safe map, but those don't offer type safety like the built in map object.
Added some missing licensing and a VERSION file as Jenkins is requiring it.
Change-Id: I755709ab4678da12c7585824074a1877f98a5ea1
diff --git a/omci_sim.go b/omci_sim.go
index 6cc0708..a792911 100644
--- a/omci_sim.go
+++ b/omci_sim.go
@@ -51,9 +51,11 @@
}).Tracef("Processing OMCI pakcet")
key := OnuKey{intfId, onuId}
+ OnuOmciStateMapLock.Lock()
if _, ok := OnuOmciStateMap[key]; !ok {
OnuOmciStateMap[key] = NewOnuOmciState()
}
+ OnuOmciStateMapLock.Unlock()
if _, ok := Handlers[msgType]; !ok {
log.WithFields(log.Fields{
@@ -111,4 +113,4 @@
}).Tracef("OMCI-SIM Response")
return resp, nil
-}
\ No newline at end of file
+}