Permalink
Browse files

changed some unsafe_unretained properties to weak, added archiveNow m…

…ethod
  • Loading branch information...
1 parent 924510c commit cb44294a1976deb1e9fff05ed5127d8f5b68f221 @artifacts committed Dec 6, 2013
Showing with 16 additions and 6 deletions.
  1. +4 −0 src/shared/AFCache.h
  2. +6 −0 src/shared/AFCache.m
  3. +6 −6 src/shared/AFCacheableItem.h
View
@@ -275,6 +275,10 @@ typedef struct NetworkTimeoutIntervals {
- (void)invalidateAll;
- (void)archive;
+/**
+ * Starts the archiving Thread without a delay.
+ */
+- (void)archiveNow;
- (BOOL)isOffline;
- (void)setOffline:(BOOL)value;
- (int)totalRequestsForSession;
View
@@ -876,6 +876,12 @@ - (void)archive {
wantsToArchive_ = YES;
}
+- (void)archiveNow {
+ [archiveTimer invalidate];
+ [self startArchiveThread:nil];
+ [self archive];
+}
+
/* removes every file in the cache directory */
- (void)invalidateAll {
NSError *error;
@@ -52,14 +52,14 @@ typedef void (^AFCacheableItemBlock)(AFCacheableItem* item);
NSURLRequest *request;
NSData *data;
AFCache *cache;
- id <AFCacheableItemDelegate> __unsafe_unretained delegate;
+ id <AFCacheableItemDelegate> __weak delegate;
BOOL persistable;
BOOL ignoreErrors;
BOOL justFetchHTTPHeader;
SEL connectionDidFinishSelector;
SEL connectionDidFailSelector;
NSError *error;
- id __unsafe_unretained userData;
+ id __weak userData;
// validUntil holds the calculated expire date of the cached object.
// It is either equal to Expires (if Expires header is set), or the date
@@ -86,7 +86,7 @@ typedef void (^AFCacheableItemBlock)(AFCacheableItem* item);
BOOL servedFromCache;
BOOL URLInternallyRewritten;
BOOL canMapData;
- NSURLConnection *__unsafe_unretained _connection;
+ NSURLConnection *__weak _connection;
#if NS_BLOCKS_AVAILABLE
//block to execute when request completes successfully
@@ -99,7 +99,7 @@ typedef void (^AFCacheableItemBlock)(AFCacheableItem* item);
@property (nonatomic, strong) NSURL *url;
@property (nonatomic, strong) NSData *data;
@property (nonatomic, strong) AFCache *cache;
-@property (nonatomic, unsafe_unretained) id <AFCacheableItemDelegate> delegate;
+@property (nonatomic, weak) id <AFCacheableItemDelegate> delegate;
@property (nonatomic, strong) NSError *error;
@property (nonatomic, strong) NSDate *validUntil;
@property (nonatomic, assign) BOOL persistable;
@@ -109,7 +109,7 @@ typedef void (^AFCacheableItemBlock)(AFCacheableItem* item);
@property (nonatomic, assign) SEL connectionDidFailSelector;
@property (nonatomic, assign) int cacheStatus;
@property (nonatomic, strong) AFCacheableItemInfo *info;
-@property (nonatomic, unsafe_unretained) id userData;
+@property (nonatomic, weak) id userData;
@property (nonatomic, assign) BOOL isPackageArchive;
@property (nonatomic, assign) uint64_t currentContentLength;
@property (nonatomic, strong) NSString *username;
@@ -121,7 +121,7 @@ typedef void (^AFCacheableItemBlock)(AFCacheableItem* item);
@property (nonatomic, assign) BOOL isRevalidating;
@property (nonatomic, readonly) BOOL canMapData;
-@property (nonatomic, unsafe_unretained) NSURLConnection *connection;
+@property (nonatomic, weak) NSURLConnection *connection;
#if NS_BLOCKS_AVAILABLE
@property (nonatomic, copy) AFCacheableItemBlock completionBlock;

0 comments on commit cb44294

Please sign in to comment.