fix: 积压时等本帧写出再断开并让 Shutdown 等待 0x8B

This commit is contained in:
Nixevol
2026-09-30 19:21:51 +08:00
parent 2d1dfd7cd8
commit ef46563f70
6 changed files with 375 additions and 22 deletions
+2 -4
View File
@@ -175,14 +175,11 @@ func (h *nixHook) OnSubscribed(cl *mqtt.Client, pk packets.Packet, reasonCodes [
}
func (h *nixHook) OnPacketSent(cl *mqtt.Client, pk packets.Packet, _ []byte) {
if pk.FixedHeader.Type != packets.Publish {
return
}
h.b.connsMu.RLock()
st := h.b.byClient[cl]
h.b.connsMu.RUnlock()
if st != nil {
st.sentPub.Add(1)
st.notePacketSent(pk)
}
}
@@ -254,6 +251,7 @@ func (h *nixHook) OnDisconnect(cl *mqtt.Client, err error, _ bool) {
lk.Lock()
st.stopDownLoop()
lk.Unlock()
st.wirePending.Store(0)
h.b.releaseAllLarge(st)
h.b.cancelHandshakeDeadline(st.endpointID, st.connID)