Public Access
Transfers: let cancel pressed as a transfer finishes do nothing rather than throw
This commit is contained in:
1 parent
8bee476039
commit
cc3d46f78c
1 file changed
+10
-1
@@ -338,7 +338,16 @@ public sealed class FileTransferQueue : IAsyncDisposable
|
||||
}
|
||||
}
|
||||
|
||||
running?.Cancel();
|
||||
// Outside the gate, because cancelling runs the token's callbacks on this thread — but that leaves a
|
||||
// moment in which the run finishes and disposes the source it was read from. A disposed source is a
|
||||
// transfer that is already over, so there is nothing left to cancel and nothing to report.
|
||||
try
|
||||
{
|
||||
running?.Cancel();
|
||||
}
|
||||
catch (ObjectDisposedException)
|
||||
{
|
||||
}
|
||||
|
||||
if (cancelled is not null)
|
||||
{
|
||||
|
||||
Reference in new issue
Block a user