Allow file owners to revoke active transfers on custody expiry or deletion
This commit is contained in:
1 parent
84c148acff
commit
e47c7fb2ac
2 files changed
+13
No files matched your search
@@ -329,3 +329,14 @@ struct file_transfer_op* file_transfer_pull(struct file_transfer* ft, uint64_t g
|
||||
void file_transfer_cancel(struct file_transfer_op* op) {
|
||||
if (op) ft_finish(op, -2);
|
||||
}
|
||||
|
||||
void file_transfer_cancel_object(struct file_transfer* ft, const uint8_t object[16]) {
|
||||
if (!ft) return;
|
||||
for (;;) {
|
||||
struct file_transfer_op* found = NULL;
|
||||
for (struct file_transfer_op* op = ft->ops; op; op = op->next)
|
||||
if (!memcmp(op->object, object, 16)) { found = op; break; }
|
||||
if (!found) break;
|
||||
ft_finish(found, -2);
|
||||
}
|
||||
}
|
||||
@@ -28,5 +28,7 @@ struct file_transfer_op* file_transfer_pull(struct file_transfer* ft, uint64_t g
|
||||
const uint8_t object[16], uint64_t size, const char* destination,
|
||||
file_transfer_done_fn done, void* arg);
|
||||
void file_transfer_cancel(struct file_transfer_op* op);
|
||||
/* Отозвать все операции объекта (TTL/delete); callbacks приёма вызываются с -2. */
|
||||
void file_transfer_cancel_object(struct file_transfer* ft, const uint8_t object[16]);
|
||||
|
||||
#endif
|
||||
Reference in new issue
Block a user