修改:delay 代词拼写错误
git-svn-id: svn://47.119.165.148/zhub@96 e63fbceb-bcc3-4977-ac22-735b83d8d0f4
This commit is contained in:
@@ -149,8 +149,8 @@ func (c *Client) Broadcast(topic string, message string) error {
|
|||||||
return c.send("broadcast", topic, message)
|
return c.send("broadcast", topic, message)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *Client) Daly(topic string, message string, daly int) error {
|
func (c *Client) Delay(topic string, message string, delay int) error {
|
||||||
return c.send("daly", topic, message, strconv.Itoa(daly))
|
return c.send("delay", topic, message, strconv.Itoa(delay))
|
||||||
}
|
}
|
||||||
|
|
||||||
/*func (c *Client) Timer(topic string, expr string, fun func()) {
|
/*func (c *Client) Timer(topic string, expr string, fun func()) {
|
||||||
@@ -264,9 +264,9 @@ func (c *Client) receive() {
|
|||||||
c.timerReceive <- vs
|
c.timerReceive <- vs
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
/*if len(vs) == 2 && strings.EqualFold(vs[0], "daly") {
|
/*if len(vs) == 2 && strings.EqualFold(vs[0], "delay") {
|
||||||
c.dalyFun[vs[1]]()
|
c.delayFun[vs[1]]()
|
||||||
delete(c.dalyFun, vs[1])
|
delete(c.delayFun, vs[1])
|
||||||
continue
|
continue
|
||||||
}*/
|
}*/
|
||||||
|
|
||||||
|
|||||||
@@ -36,7 +36,7 @@ func TestCli(t *testing.T) {
|
|||||||
client.Subscribe("a", func(v string) {
|
client.Subscribe("a", func(v string) {
|
||||||
log.Println("收到主题 a 消息 " + v)
|
log.Println("收到主题 a 消息 " + v)
|
||||||
})
|
})
|
||||||
client.Daly("a", "x", 3000)
|
client.Delay("a", "x", 3000)
|
||||||
|
|
||||||
time.Sleep(time.Hour * 3)
|
time.Sleep(time.Hour * 3)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -38,7 +38,7 @@ func msgAccept(v Message) {
|
|||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
arr := []string{"subscribe", "unsubscribe", "daly", "groupid"}
|
arr := []string{"subscribe", "unsubscribe", "delay", "groupid"}
|
||||||
if startWithAny(rcmd[0], arr...) {
|
if startWithAny(rcmd[0], arr...) {
|
||||||
rcmd = strings.Split(rcmd[0], " ")
|
rcmd = strings.Split(rcmd[0], " ")
|
||||||
} else {
|
} else {
|
||||||
@@ -69,8 +69,8 @@ func msgAccept(v Message) {
|
|||||||
}
|
}
|
||||||
case "broadcast":
|
case "broadcast":
|
||||||
zsub.broadcast(rcmd[1], rcmd[2])
|
zsub.broadcast(rcmd[1], rcmd[2])
|
||||||
case "daly":
|
case "delay":
|
||||||
zsub.daly(rcmd, c)
|
zsub.delay(rcmd, c)
|
||||||
case "timer":
|
case "timer":
|
||||||
zsub.timer(rcmd, c)
|
zsub.timer(rcmd, c)
|
||||||
case "cmd":
|
case "cmd":
|
||||||
@@ -87,8 +87,8 @@ func msgAccept(v Message) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// daly topic value 100 -> publish topic value
|
// delay topic value 100 -> publish topic value
|
||||||
func (s *ZSub) daly(rcmd []string, c *ZConn) {
|
func (s *ZSub) delay(rcmd []string, c *ZConn) {
|
||||||
s.Lock()
|
s.Lock()
|
||||||
defer s.Unlock()
|
defer s.Unlock()
|
||||||
if len(rcmd) != 4 {
|
if len(rcmd) != 4 {
|
||||||
|
|||||||
@@ -149,7 +149,7 @@ func (s *ZSub) close(c *ZConn) {
|
|||||||
s.unsubscribe(c, topic)
|
s.unsubscribe(c, topic)
|
||||||
}
|
}
|
||||||
|
|
||||||
// daly
|
// delay
|
||||||
|
|
||||||
// timer conn close
|
// timer conn close
|
||||||
s.Lock()
|
s.Lock()
|
||||||
|
|||||||
Reference in New Issue
Block a user