f33f7b5c29
+ Refactored all imports + Fixed a bug for the logging regarding removing \n \t \r + Updated to current MGO release + Changed the name of ICCC
41 lines
917 B
Go
41 lines
917 B
Go
package NumGen
|
|
|
|
import (
|
|
"github.com/SommerEngineering/Ocean/Log"
|
|
LM "github.com/SommerEngineering/Ocean/Log/Meta"
|
|
"github.com/SommerEngineering/Ocean/Shutdown"
|
|
)
|
|
|
|
func requestChannel4Name(name string) (result chan int64) {
|
|
|
|
if Shutdown.IsDown() {
|
|
return
|
|
}
|
|
|
|
if !isActive {
|
|
Log.LogFull(senderName, LM.CategorySYSTEM, LM.LevelWARN, LM.SeverityCritical, LM.ImpactNone, LM.MessageNameCONFIGURATION, `Called the requestChannel4Name() on an inactive host.`, `Wrong configuration?`)
|
|
return
|
|
}
|
|
|
|
channelListLock.RLock()
|
|
channel, isPresent := channelList[name]
|
|
channelListLock.RUnlock()
|
|
|
|
if isPresent {
|
|
result = channel
|
|
return
|
|
}
|
|
|
|
// Create the entry:
|
|
newChannel := make(chan int64, channelBufferSize)
|
|
result = newChannel
|
|
|
|
channelListLock.Lock()
|
|
channelList[name] = newChannel
|
|
channelListLock.Unlock()
|
|
|
|
// Create the new producer:
|
|
go producer(name)
|
|
return
|
|
}
|