mirror of
https://github.com/chatmail/core.git
synced 2026-04-24 08:56:29 +03:00
Add clarifying comments and improve documentation based on code review
Co-authored-by: link2xt <18373967+link2xt@users.noreply.github.com>
This commit is contained in:
10
src/calls.rs
10
src/calls.rs
@@ -196,8 +196,10 @@ impl Context {
|
||||
..Default::default()
|
||||
};
|
||||
|
||||
// Set a placeholder parameter so the message is recognized as a call
|
||||
// This will be used by mimefactory until the DB entry is available
|
||||
// Set a placeholder parameter so the message is recognized as a call during sending.
|
||||
// This ensures mimefactory can read the SDP during the brief window between
|
||||
// send_msg() starting and the calls table entry being available.
|
||||
// The param will be removed after send_msg() completes.
|
||||
call.param.set(Param::WebrtcRoom, &place_call_info);
|
||||
call.id = send_msg(self, chat_id, &mut call).await?;
|
||||
|
||||
@@ -521,7 +523,9 @@ impl Context {
|
||||
return Ok(None);
|
||||
}
|
||||
|
||||
// Load SDP from calls table
|
||||
// Load SDP from calls table. Returns empty strings if no record exists,
|
||||
// which can happen for old messages from before the migration or for
|
||||
// calls where SDPs have been cleaned up by housekeeping.
|
||||
let (place_call_info, accept_call_info) = self
|
||||
.sql
|
||||
.query_row_optional(
|
||||
|
||||
@@ -921,12 +921,13 @@ pub async fn housekeeping(context: &Context) -> Result<()> {
|
||||
.log_err(context)
|
||||
.ok();
|
||||
|
||||
// Delete call SDPs for ended calls (older than 24 hours) or orphaned calls.
|
||||
// Delete call SDPs for ended calls (older than 24 hours) or trashed calls.
|
||||
// We clean up calls that ended more than 24 hours ago to protect privacy
|
||||
// as SDPs contain IP addresses. Ended calls are identified by having
|
||||
// the CALL_ENDED_TIMESTAMP parameter (Param::Arg4) set.
|
||||
// The ON DELETE CASCADE foreign key will handle orphaned entries automatically,
|
||||
// but we also check for trash and old ended calls.
|
||||
// the CALL_ENDED_TIMESTAMP parameter (Param::Arg4='H') set.
|
||||
// The pattern '%H=%' matches this parameter since params are stored as
|
||||
// newline-separated key=value pairs (e.g., "E=123\nH=456\n").
|
||||
// The ON DELETE CASCADE foreign key handles orphaned entries automatically.
|
||||
context
|
||||
.sql
|
||||
.execute(
|
||||
|
||||
Reference in New Issue
Block a user