fix(member-files): prevent restart after early transfer cancellation
This commit is contained in:
1 parent
3814adee02
commit
cefa7316ae
2 files changed
+5
-1
No files matched your search
@@ -80,6 +80,7 @@ typedef void (*mf_transfer_fn)(void* arg, const struct mf_transfer_progress* pro
|
||||
struct mf_transfer* member_files_transfer_start(const struct mf_transfer_request* request, mf_transfer_fn callback, void* arg);
|
||||
|
||||
// Запросить отмену своей передачи; завершение приходит через finished после закрытия её файлового I/O.
|
||||
// Допустимо сразу после start: поздний CM UP не запускает подготовку/STAT заново. Финализируемый результат уже не отменяется.
|
||||
void member_files_transfer_cancel(struct mf_transfer* transfer);
|
||||
|
||||
// ── Команды интерфейса для передачи и отмены ──
|
||||
|
||||
@@ -60,6 +60,7 @@ static void transfer_event(struct mf_transfer* t, int finished) {
|
||||
}
|
||||
|
||||
static void transfer_wake(struct mf_transfer* t) {
|
||||
if (t->stopping && !t->reply_ready) return;
|
||||
if (t->pump || t->waiter.internal || t->waiter.call_soon_id || t->files->closing) return;
|
||||
t->pump = uasync_call_soon(t->files->inst->ua, t, transfer_pump);
|
||||
if (!t->pump) DEBUG_ERROR(DEBUG_CATEGORY_MEDIA, "member_files: stream pump allocation failed id=%llu", (unsigned long long)t->request.id);
|
||||
@@ -270,7 +271,9 @@ static void transfer_stop(struct mf_transfer* t, int status) {
|
||||
DEBUG_WARN(DEBUG_CATEGORY_MEDIA, "member_files: stream stopped id=%llu peer=%llx reason=%s",
|
||||
(unsigned long long)t->request.id, (unsigned long long)t->request.server, mf_status_text(status));
|
||||
}
|
||||
t->stopping = 1;
|
||||
DEBUG_DEBUG(DEBUG_CATEGORY_MEDIA, "member_files: stream stopping id=%llu starting=%d active=%d io=%d pending=%d",
|
||||
(unsigned long long)t->request.id, t->starting, t->active, t->busy, t->pending != NULL);
|
||||
t->stopping = 1; t->starting = 0;
|
||||
if (t->pump) { uasync_call_soon_cancel(t->files->inst->ua, t->pump); t->pump = NULL; }
|
||||
etcp_router_cancel_send_ready(t->files->inst, t->request.group, t->request.server, ETCP_RT_ID_MEMBER_FILES, &t->waiter);
|
||||
if (t->pending) { struct mf_pending* p = t->pending; t->pending = NULL; member_files_cancel(p); }
|
||||
|
||||
Reference in new issue
Block a user