Fix TCP messaging, LoRa status reversion, and message ordering (v1.5.8)

- TCPClientInterface overrides needs_transport_headers() so hops==1
  packets get HEADER_2 wrapping through the hub
- Track savedCounter in LXMFMessage and use direct filename lookup
  for status updates, fixing LoRa uptime-timestamp precision loss
  that caused SENT status to revert to QUEUED on reload
- Remove timestamp-based re-sort in loadConversation() which broke
  chronological order when mixing LoRa (uptime) and TCP (epoch)
  timestamps; counter-based filenames already provide correct order
This commit is contained in:
DeFiDude
2026-03-10 00:49:59 -06:00
parent 6f272596c8
commit fb9eb4a4c3
5 changed files with 50 additions and 13 deletions
+5 -2
View File
@@ -30,7 +30,9 @@ void LXMFManager::loop() {
// Persist updated status to disk so reloads don't revert to QUEUED
std::string peerHex = msg.destHash.toHex();
if (_store) {
if (_store && msg.savedCounter > 0) {
_store->updateMessageStatusByCounter(peerHex, msg.savedCounter, false, msg.status);
} else if (_store) {
_store->updateMessageStatus(peerHex, msg.timestamp, false, msg.status);
}
@@ -60,7 +62,8 @@ bool LXMFManager::sendMessage(const RNS::Bytes& destHash, const std::string& con
if ((int)_outQueue.size() >= RATDECK_MAX_OUTQUEUE) { _outQueue.pop_front(); }
_outQueue.push_back(msg);
// Immediately save with QUEUED status so it appears in getMessages() right away
if (_store) { _store->saveMessage(msg); }
// Save the queue copy so savedCounter propagates back to the queued message
if (_store) { _store->saveMessage(_outQueue.back()); }
return true;
}