mirror of
https://github.com/rustdesk/hbb_common.git
synced 2026-10-22 16:27:44 +00:00
webrtc: split the send budget, make close_webrtc uncancellable, restore log retention
- send_bytes computed one deadline before acquiring the send gate and reused it for the write, so time queued behind another clone's message was charged to this message. A caller that only just lost the gate race got a few milliseconds to write in and then tore the whole peer connection down for missing them - the narrower the miss, the more certain the teardown. The write gets its own budget; the gate wait keeps the one it had, and still never closes (it never held the permit). - Stream::close_webrtc awaited WebRTCStream::close, which is exactly the form close_detached exists to avoid: most callers sit in a select! arm or a future the UI can abandon, and a cancelled close is unretryable (is_closed is latched before the first await, so later attempts early-return and the handler that evicts the session never runs). It is now a plain fn calling close_detached - with no await point there is nothing to cancel. close_detached is public and carries the runtime-teardown guard the parent repo had written separately for its Drop path, so that copy goes away. - Log retention goes back to 31 files. Raising it to 31*8 defended the flood case badly (a file count cannot outrun a flood; only the rate limits at the log sites can) while silently multiplying steady-state retention and disk for every ordinary install, on every platform. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01ExUfAkYbq8UC9pQCiLy8TQ
This commit is contained in:
1 parent
faf1723577
commit
e8ec370b08
3 files changed
+45
-20
No files matched your search
+7
-7
@@ -464,13 +464,13 @@ pub fn init_log(_is_async: bool, _name: &str) -> Option<flexi_logger::LoggerHand
|
||||
// much disk this uses. Bounding it here covers every call site at once.
|
||||
Criterion::AgeOrSize(Age::Day, 16 * 1024 * 1024),
|
||||
Naming::Timestamps,
|
||||
// Retention is a file count, so adding the size criterion also shortened
|
||||
// the history a flood can leave behind: the same actor that motivates the
|
||||
// size cap can now force rotations until every file predating its own
|
||||
// activity is cleaned up. Keep enough files that ~90 days survives even
|
||||
// when every one of them is a full 16 MiB — trading a bounded amount of
|
||||
// disk for not handing an attacker a log-erasure primitive.
|
||||
Cleanup::KeepLogFiles(90 * 8),
|
||||
// 90 files is ~90 days for any machine that stays under the
|
||||
// size criterion — i.e. every ordinary install, on every platform this
|
||||
// ships to. Raising it to protect the flood case would have bought little
|
||||
// (a count cannot outrun a flood; only the rate limits at the log sites
|
||||
// can) at the price of multiplying steady-state retention and disk for
|
||||
// everyone.
|
||||
Cleanup::KeepLogFiles(90),
|
||||
)
|
||||
.start()
|
||||
.ok();
|
||||
|
||||
Reference in new issue
Block a user