修改:代码结构、完成timer、sub/puh 测试

git-svn-id: svn://47.119.165.148/zhub@64 e63fbceb-bcc3-4977-ac22-735b83d8d0f4
This commit is contained in:
lxy
2021-01-10 16:37:46 +00:00
parent f1b7a862f9
commit 01ced95223
9 changed files with 172 additions and 87 deletions

View File

@@ -6,9 +6,24 @@ type ZTopic struct { //ZTopic
sync.Mutex
groups map[string]*ZGroup
mcount int
topic string // 主题名称
chMsg chan string // 主题消息投递
}
// 主题消息发送
func (t *ZTopic) init() {
go func() {
for {
msg, ok := <-t.chMsg
if !ok {
break
}
for _, group := range t.groups {
group.chMsg <- msg
}
}
}()
}
//