1 Star 0 Fork 2

何吕/volantmq

forked from JUMEI_ARCH/volantmq 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
ack.go 528 Bytes
一键复制 编辑 原始数据 按行查看 历史
Artur Troian 提交于 2017-09-25 14:09 . Panic at disconnect ref #69
package connection
import (
"sync"
"github.com/VolantMQ/volantmq/packet"
)
type onRelease func(o, n packet.Provider)
type ackQueue struct {
messages sync.Map
onRelease onRelease
}
func (a *ackQueue) store(pkt packet.Provider) {
id, _ := pkt.ID()
a.messages.Store(id, pkt)
}
func (a *ackQueue) release(pkt packet.Provider) {
id, _ := pkt.ID()
if value, ok := a.messages.Load(id); ok {
if orig, ok := value.(packet.Provider); ok && a.onRelease != nil {
a.onRelease(orig, pkt)
}
a.messages.Delete(id)
}
}
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Go
1
https://gitee.com/kaifazhe/volantmq.git
git@gitee.com:kaifazhe/volantmq.git
kaifazhe
volantmq
volantmq
v0.0.4

搜索帮助

A270a887 8829481 3d7a4017 8829481