fix: 积压时等本帧写出再断开并让 Shutdown 等待 0x8B
This commit is contained in:
@@ -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)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user