Fixed a crash in MQTT outgoing PUBREL

This really was a cut/paste/typo error.

The effect was that when there was a pending PUBREL in JetStream, we would sometimes attempt to deliver it immediately once the client connected, cpending was already initialized, but the pubrel map was not (yet).
This commit is contained in:
Lev Brouk
2023-10-10 18:08:18 -07:00
parent 6a5304cfac
commit de1282c98d

View File

@@ -2891,10 +2891,11 @@ func (sess *mqttSession) trackAsPubRel(pi uint16, jsAckSubject string) {
sseq, _, _ := ackReplyInfo(jsAckSubject)
var sseqToPi map[uint64]uint16
if sess.cpending == nil {
sess.cpending = make(map[string]map[uint64]uint16)
} else if sseqToPi = sess.cpending[jsDur]; sseqToPi == nil {
}
sseqToPi := sess.cpending[jsDur]
if sseqToPi == nil {
sseqToPi = make(map[uint64]uint16)
sess.cpending[jsDur] = sseqToPi
}