diff options
author | Jocelyn Turcotte <jturcotte@woboq.com> | 2015-05-06 13:50:53 +0300 |
---|---|---|
committer | Jocelyn Turcotte <jturcotte@woboq.com> | 2015-05-06 17:56:50 +0300 |
commit | 0a67719f2fce9d46bf009755fd1b1759c57bb4c4 (patch) | |
tree | ce061df152d08a9c4dd9bc5f8e6b21e8797aaad9 /shell_integration/MacOSX | |
parent | 04d820f9cf17fa841bc48ac4c6046ba3a4afa0ae (diff) |
shell_integration on OSX: Do not fill the cache with unsolicited statuses #3122
Diffstat (limited to 'shell_integration/MacOSX')
-rw-r--r-- | shell_integration/MacOSX/OwnCloudFinder/RequestManager.h | 1 | ||||
-rw-r--r-- | shell_integration/MacOSX/OwnCloudFinder/RequestManager.m | 10 |
2 files changed, 10 insertions, 1 deletions
diff --git a/shell_integration/MacOSX/OwnCloudFinder/RequestManager.h b/shell_integration/MacOSX/OwnCloudFinder/RequestManager.h index 130c885c6..e5d4c19e1 100644 --- a/shell_integration/MacOSX/OwnCloudFinder/RequestManager.h +++ b/shell_integration/MacOSX/OwnCloudFinder/RequestManager.h @@ -22,6 +22,7 @@ NSMutableArray* _requestQueue; NSMutableDictionary* _registeredPathes; + NSMutableSet* _requestedPaths; NSString *_shareMenuTitle; diff --git a/shell_integration/MacOSX/OwnCloudFinder/RequestManager.m b/shell_integration/MacOSX/OwnCloudFinder/RequestManager.m index 52f5d9f54..62399a441 100644 --- a/shell_integration/MacOSX/OwnCloudFinder/RequestManager.m +++ b/shell_integration/MacOSX/OwnCloudFinder/RequestManager.m @@ -31,6 +31,7 @@ static RequestManager* sharedInstance = nil; _isConnected = NO; _registeredPathes = [[NSMutableDictionary alloc] init]; + _requestedPaths = [[NSMutableSet alloc] init]; _shareMenuTitle = nil; @@ -106,6 +107,7 @@ static RequestManager* sharedInstance = nil; NSString *verb = @"RETRIEVE_FILE_STATUS"; if( [self isRegisteredPath:path isDirectory:isDir] ) { + [_requestedPaths addObject:path]; if( _isConnected ) { if(isDir) { verb = @"RETRIEVE_FOLDER_STATUS"; @@ -141,9 +143,13 @@ static RequestManager* sharedInstance = nil; path, [chunks objectAtIndex:i+1] ]; } } - [contentman setResultForPath:path result:[chunks objectAtIndex:1]]; + // The client will broadcast all changes, do not fill the cache for paths that Finder didn't ask for. + if ([_requestedPaths containsObject:path]) { + [contentman setResultForPath:path result:[chunks objectAtIndex:1]]; + } } else if( [[chunks objectAtIndex:0] isEqualToString:@"UPDATE_VIEW"] ) { NSString *path = [chunks objectAtIndex:1]; + [_requestedPaths removeAllObjects]; [contentman reFetchFileNameCacheForPath:path]; } else if( [[chunks objectAtIndex:0 ] isEqualToString:@"REGISTER_PATH"] ) { NSNumber *one = [NSNumber numberWithInt:1]; @@ -192,6 +198,7 @@ static RequestManager* sharedInstance = nil; for( NSString *path in _requestQueue ) { [self askOnSocket:path query:@"RETRIEVE_FILE_STATUS"]; } + [_requestQueue removeAllObjects]; } ContentManager *contentman = [ContentManager sharedInstance]; @@ -212,6 +219,7 @@ static RequestManager* sharedInstance = nil; // clear the registered pathes. [_registeredPathes release]; _registeredPathes = [[NSMutableDictionary alloc] init]; + [_requestedPaths removeAllObjects]; // clear the caches in conent manager ContentManager *contentman = [ContentManager sharedInstance]; |