|
|
@@ -198,6 +198,7 @@ open class ImageDownloader {
|
|
|
/// You could change the configuration before a downloaing task starts. A configuration without persistent storage for caches is requsted for downloader working correctly.
|
|
|
open var sessionConfiguration = URLSessionConfiguration.ephemeral {
|
|
|
didSet {
|
|
|
+ session?.invalidateAndCancel()
|
|
|
session = URLSession(configuration: sessionConfiguration, delegate: sessionHandler, delegateQueue: OperationQueue.main)
|
|
|
}
|
|
|
}
|
|
|
@@ -249,6 +250,10 @@ open class ImageDownloader {
|
|
|
session = URLSession(configuration: sessionConfiguration, delegate: sessionHandler, delegateQueue: .main)
|
|
|
}
|
|
|
|
|
|
+ deinit {
|
|
|
+ session?.invalidateAndCancel()
|
|
|
+ }
|
|
|
+
|
|
|
func fetchLoad(for url: URL) -> ImageFetchLoad? {
|
|
|
var fetchLoad: ImageFetchLoad?
|
|
|
barrierQueue.sync { fetchLoad = fetchLoads[url] }
|