This commit is contained in:
zhouyuyan
2017-08-23 19:24:27 +08:00
parent fe936d0e37
commit 00abbac00f
5 changed files with 141 additions and 24 deletions
+18 -1
View File
@@ -8,7 +8,23 @@ import (
log "github.com/cihub/seelog"
)
//https://github.com/xiaojiaqi/10billionhongbaos
const (
MaxUser = 1024 * 1024
MessagePoolNum = 1024
MessagePoolUser = MaxUser / MessagePoolNum
MessagePoolMessageNum = MaxUser / MessagePoolNum * 4
)
var (
MSGPool []MessagePool
)
func init() {
MSGPool = make([]MessagePool, (MessagePoolNum + 2))
for i := 0; i < (MessagePoolNum + 2); i++ {
MSGPool[i].Init(MessagePoolUser, MessagePoolMessageNum)
}
}
func main() {
broker := broker.NewBroker()
broker.StartListening()
@@ -16,6 +32,7 @@ func main() {
s := waitForSignal()
log.Infof("signal got: %v ,broker closed.", s)
}
func waitForSignal() os.Signal {
signalChan := make(chan os.Signal, 1)
defer close(signalChan)