diff --git a/Sources/DVR/SessionDataTask.swift b/Sources/DVR/SessionDataTask.swift index 8ac1a3a..0688d34 100644 --- a/Sources/DVR/SessionDataTask.swift +++ b/Sources/DVR/SessionDataTask.swift @@ -1,5 +1,7 @@ import Foundation +private var globalTaskIdentifier: Int = 100000 + final class SessionDataTask: URLSessionDataTask { // MARK: - Types @@ -19,6 +21,18 @@ final class SessionDataTask: URLSessionDataTask { return interaction?.response } + var _taskIdentifier: Int = { + globalTaskIdentifier += 1 + return globalTaskIdentifier + }() + override var taskIdentifier: Int { + return _taskIdentifier + } + + var _originalRequest: URLRequest? + override var originalRequest: URLRequest? { + return _originalRequest + } // MARK: - Initializers diff --git a/Sources/DVR/SessionDownloadTask.swift b/Sources/DVR/SessionDownloadTask.swift index 0cd70df..0e20dc4 100644 --- a/Sources/DVR/SessionDownloadTask.swift +++ b/Sources/DVR/SessionDownloadTask.swift @@ -1,5 +1,7 @@ import Foundation +private var globalTaskIdentifier: Int = 200000 + final class SessionDownloadTask: URLSessionDownloadTask { // MARK: - Types @@ -12,6 +14,18 @@ final class SessionDownloadTask: URLSessionDownloadTask { let request: URLRequest let completion: Completion? + var _taskIdentifier: Int = { + globalTaskIdentifier += 1 + return globalTaskIdentifier + }() + override var taskIdentifier: Int { + return _taskIdentifier + } + + var _originalRequest: URLRequest? + override var originalRequest: URLRequest? { + return _originalRequest + } // MARK: - Initializers diff --git a/Sources/DVR/SessionUploadTask.swift b/Sources/DVR/SessionUploadTask.swift index fb66596..daf0024 100644 --- a/Sources/DVR/SessionUploadTask.swift +++ b/Sources/DVR/SessionUploadTask.swift @@ -1,5 +1,7 @@ import Foundation +private var globalTaskIdentifier: Int = 300000 + final class SessionUploadTask: URLSessionUploadTask { // MARK: - Types @@ -13,6 +15,19 @@ final class SessionUploadTask: URLSessionUploadTask { let completion: Completion? let dataTask: SessionDataTask + var _taskIdentifier: Int = { + globalTaskIdentifier += 1 + return globalTaskIdentifier + }() + override var taskIdentifier: Int { + return _taskIdentifier + } + + var _originalRequest: URLRequest? + override var originalRequest: URLRequest? { + return _originalRequest + } + // MARK: - Initializers init(session: Session, request: URLRequest, completion: Completion? = nil) {