diff --git a/DVR/SessionDataTask.swift b/DVR/SessionDataTask.swift index 61f3761..0688d34 100644 --- a/DVR/SessionDataTask.swift +++ b/DVR/SessionDataTask.swift @@ -34,7 +34,6 @@ final class SessionDataTask: URLSessionDataTask { return _originalRequest } - // MARK: - Initializers init(session: Session, request: URLRequest, completion: (Completion)? = nil) { diff --git a/DVR/SessionDownloadTask.swift b/DVR/SessionDownloadTask.swift index d60139b..3f12b7d 100644 --- a/DVR/SessionDownloadTask.swift +++ b/DVR/SessionDownloadTask.swift @@ -1,3 +1,5 @@ +private var globalTaskIdentifier: Int = 100000 + final class SessionDownloadTask: URLSessionDownloadTask { // MARK: - Types @@ -10,6 +12,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/DVR/SessionUploadTask.swift b/DVR/SessionUploadTask.swift index b316f86..7c9ada1 100644 --- a/DVR/SessionUploadTask.swift +++ b/DVR/SessionUploadTask.swift @@ -1,3 +1,5 @@ +private var globalTaskIdentifier: Int = 100000 + final class SessionUploadTask: URLSessionUploadTask { // MARK: - Types @@ -11,6 +13,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) {