Fix Noise handshake failures and implement binary protocol migration

- Fix asymmetric handshake state causing message delivery failures
- Prevent duplicate handshake init messages from disrupting ongoing handshakes
- Add defensive copying to all binary decoders to prevent thread safety issues
- Implement binary encoding for all 9 message types (60-80% bandwidth reduction)
- Fix delivery ACK decoding for Noise encrypted messages
- Add comprehensive logging for debugging handshake and message flow
- Fix race condition in delivery status updates
- Add relay logic for handshake packets to ensure mesh delivery
- Maintain backward compatibility with JSON fallback
This commit is contained in:
jack
2025-07-22 14:52:33 +02:00
parent 7579612c61
commit 5e726f993e
6 changed files with 226 additions and 93 deletions
+1
View File
@@ -3654,6 +3654,7 @@ extension ChatViewModel: BitchatDelegate {
}
private func updateMessageDeliveryStatus(_ messageID: String, status: DeliveryStatus) {
print("🔄 Updating UI delivery status for message \(messageID): \(status)")
// Helper function to check if we should skip this update
func shouldSkipUpdate(currentStatus: DeliveryStatus?, newStatus: DeliveryStatus) -> Bool {