fix: PublishUp 失败时换 rid 并继续泵发送队列
This commit is contained in:
+16
-11
@@ -202,19 +202,24 @@ func (c *Client) dispatchSend(tr transport, item *sendItem, rid string, payload
|
||||
if err := tr.PublishUp(payload); err != nil {
|
||||
c.mu.Lock()
|
||||
delete(c.pending, rid)
|
||||
if item.epoch == epoch && item.inflight {
|
||||
item.inflight = false
|
||||
if c.inflight > 0 {
|
||||
c.inflight--
|
||||
}
|
||||
if c.stopReconnect {
|
||||
errStop := c.stopErrLocked()
|
||||
c.mu.Unlock()
|
||||
c.finishSend(item, SendResult{}, errStop)
|
||||
return
|
||||
}
|
||||
if item.epoch != epoch || !item.inflight {
|
||||
c.mu.Unlock()
|
||||
return
|
||||
}
|
||||
item.inflight = false
|
||||
if c.inflight > 0 {
|
||||
c.inflight--
|
||||
}
|
||||
if c.stopReconnect {
|
||||
errStop := c.stopErrLocked()
|
||||
c.mu.Unlock()
|
||||
c.finishSend(item, SendResult{}, errStop)
|
||||
return
|
||||
}
|
||||
// 保留 id/body/send_at_ms,换新 rid 后继续泵,避免 Send 永久挂起。
|
||||
c.regenerateSendLocked(item)
|
||||
c.mu.Unlock()
|
||||
c.drainSendQueue()
|
||||
return
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user