diff --git a/voice.py b/voice.py index 241387b..5085226 100644 --- a/voice.py +++ b/voice.py @@ -263,7 +263,7 @@ class VoiceSession: # NOTE: HTTP fetch is useless here — keys are Matrix-E2EE encrypted (m.room.encrypted). pre_max_idx = max(self._caller_all_keys.keys()) if self._caller_all_keys else -1 logger.info("Waiting for EC key rotation via nio sync (current max_idx=%d)...", pre_max_idx) - for _attempt in range(20): # up to 10s (20 × 0.5s) + for _attempt in range(4): # up to 2s (4 × 0.5s) await asyncio.sleep(0.5) new_max = max(self._caller_all_keys.keys()) if self._caller_all_keys else -1 if new_max > pre_max_idx: @@ -271,10 +271,10 @@ class VoiceSession: logger.info("Key rotated: index %d→%d (%d bytes)", pre_max_idx, new_max, len(self._caller_key)) break - if _attempt % 4 == 3: # log every 2s - logger.info("Key rotation wait %ds: max_idx still %d", (_attempt + 1) // 2, new_max) + if _attempt % 2 == 1: # log every 1s + logger.info("Key rotation wait %0.1fs: max_idx still %d", (_attempt + 1) * 0.5, new_max) else: - logger.warning("No key rotation after 10s — using pre-join key[%d]", pre_max_idx) + logger.warning("No key rotation after 2s — using pre-join key[%d]", pre_max_idx) # Set per-participant keys via key provider — pass raw base keys. # KDF_HKDF=1: Rust FFI applies HKDF(base_key, ratchetSalt, ...) internally. @@ -367,7 +367,7 @@ class VoiceSession: while True: await asyncio.sleep(5) _poll_count += 1 - if _poll_count % 6 == 0: # Every 30s + if _poll_count % 2 == 0: # Every 10s try: cryptors = self.lk_room.e2ee_manager.frame_cryptors() for c in cryptors: