Commit 4d957a3d1ab1cfe9d83863a91c9f49c0ba6702ec
1 parent
d789ec01
Fix session state issues
The loop of pending messages was stuck. We saved a session expiry interval of 0. I may need to change that session copying idea.
Showing
2 changed files
with
3 additions
and
1 deletions
session.cpp
| ... | ... | @@ -70,6 +70,7 @@ Session::Session(const Session &other) |
| 70 | 70 | this->incomingQoS2MessageIds = other.incomingQoS2MessageIds; |
| 71 | 71 | this->outgoingQoS2MessageIds = other.outgoingQoS2MessageIds; |
| 72 | 72 | this->nextPacketId = other.nextPacketId; |
| 73 | + this->sessionExpiryInterval = other.sessionExpiryInterval; | |
| 73 | 74 | |
| 74 | 75 | // TODO: see git history for a change here. We now copy the whole queued publish. Do we want to address that? |
| 75 | 76 | this->qosPacketQueue = other.qosPacketQueue; |
| ... | ... | @@ -246,6 +247,7 @@ uint64_t Session::sendPendingQosMessages() |
| 246 | 247 | pos = qosPacketQueue.erase(pos); |
| 247 | 248 | continue; |
| 248 | 249 | } |
| 250 | + pos++; | |
| 249 | 251 | |
| 250 | 252 | MqttPacket p(c->getProtocolVersion(), pub); |
| 251 | 253 | p.setDuplicate(); | ... | ... |
sessionsandsubscriptionsdb.cpp
| ... | ... | @@ -132,7 +132,7 @@ SessionsAndSubscriptionsResult SessionsAndSubscriptionsDB::readDataV2() |
| 132 | 132 | const uint32_t newPubAge = persistence_state_age + originalPubAge; |
| 133 | 133 | pub.setCreatedAt(timepointFromAge(newPubAge)); |
| 134 | 134 | |
| 135 | - logger->logf(LOG_DEBUG, "Loaded QoS %d message for topic '%s'.", pub.qos, pub.topic.c_str()); | |
| 135 | + logger->logf(LOG_DEBUG, "Loaded QoS %d message for topic '%s' for session '%s'.", pub.qos, pub.topic.c_str(), ses->getClientId().c_str()); | |
| 136 | 136 | ses->qosPacketQueue.queuePublish(std::move(pub), id); |
| 137 | 137 | } |
| 138 | 138 | ... | ... |