mirror of
https://github.com/chatmail/core.git
synced 2026-05-25 09:46:31 +03:00
update iroh-share & cleanup api
This commit is contained in:
@@ -26,7 +26,7 @@ anyhow = "1"
|
||||
thiserror = "1"
|
||||
rand = "0.7"
|
||||
once_cell = "1.16.0"
|
||||
iroh-share = { git = "https://github.com/n0-computer/iroh", branch = "iroh-share" }
|
||||
iroh-share = { git = "https://github.com/n0-computer/iroh", branch = "main" }
|
||||
multibase = "0.9"
|
||||
|
||||
[features]
|
||||
|
||||
@@ -2680,13 +2680,14 @@ char* dc_backup_sender_qr (dc_context_t* context, const dc_backup_sender_t* back
|
||||
|
||||
|
||||
/**
|
||||
* Free a backup sender object.
|
||||
* Waits for the sending to finish and frees the backup sender object.
|
||||
*
|
||||
* @memberof dc_backup_sender_t
|
||||
* @param context The context.
|
||||
* @param backup_sender The backup sender object as created by dc_send_backup(),
|
||||
* If NULL is given, nothing is done.
|
||||
*/
|
||||
void dc_backup_sender_unref (dc_backup_sender_t* backup_sender);
|
||||
void dc_backup_sender_done (dc_context_t* context, dc_backup_sender_t* backup_sender);
|
||||
|
||||
|
||||
/**
|
||||
|
||||
@@ -2223,12 +2223,7 @@ pub unsafe extern "C" fn dc_send_backup(
|
||||
block_on(async move {
|
||||
imex::send_backup(ctx, folder.as_ref(), passphrase)
|
||||
.await
|
||||
.map(|(sender, transfer)| {
|
||||
Box::into_raw(Box::new(dc_backup_sender {
|
||||
_sender: sender,
|
||||
transfer,
|
||||
}))
|
||||
})
|
||||
.map(|transfer| Box::into_raw(Box::new(dc_backup_sender { transfer })))
|
||||
.log_err(ctx, "send_backup failed")
|
||||
.unwrap_or_else(|_| ptr::null_mut())
|
||||
})
|
||||
@@ -2239,7 +2234,6 @@ pub unsafe extern "C" fn dc_send_backup(
|
||||
}
|
||||
|
||||
pub struct dc_backup_sender {
|
||||
_sender: iroh_share::Sender,
|
||||
transfer: iroh_share::SenderTransfer,
|
||||
}
|
||||
|
||||
@@ -2263,10 +2257,19 @@ pub unsafe extern "C" fn dc_backup_sender_qr(
|
||||
}
|
||||
|
||||
#[no_mangle]
|
||||
pub unsafe extern "C" fn dc_backup_sender_unref(bs: *mut dc_backup_sender) {
|
||||
if !bs.is_null() {
|
||||
let _ = Box::from_raw(bs);
|
||||
pub unsafe extern "C" fn dc_backup_sender_done(ctx: *mut dc_context_t, bs: *mut dc_backup_sender) {
|
||||
if ctx.is_null() || bs.is_null() {
|
||||
eprintln!("ignoring careless call to dc_backup_sender_wait");
|
||||
return;
|
||||
}
|
||||
let ctx = &*ctx;
|
||||
let bs = Box::from_raw(bs);
|
||||
|
||||
block_on(async move {
|
||||
if let Err(e) = bs.transfer.done().await {
|
||||
error!(ctx, "sending backup failed: {:?}", e);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
#[no_mangle]
|
||||
|
||||
Reference in New Issue
Block a user