From 0438c04c1dda8a810337ab5c2329c04e82a23aab Mon Sep 17 00:00:00 2001 From: Alex Deem Date: Mon, 8 Jan 2024 13:28:54 +1100 Subject: [PATCH] Handle re-entry in SessionDataTask.resume() Alamofire can (during cancelation) attempt to resume an already running task. --- Sources/DVR/SessionDataTask.swift | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Sources/DVR/SessionDataTask.swift b/Sources/DVR/SessionDataTask.swift index 28f5c75..fe44b23 100644 --- a/Sources/DVR/SessionDataTask.swift +++ b/Sources/DVR/SessionDataTask.swift @@ -42,6 +42,10 @@ final class SessionDataTask: URLSessionDataTask { } override func resume() { + if _state == .running { + return + } + let cassette = session.cassette _state = .running