[CB-5175] CDVFileTransfer asynchronous download (Fixes #24)

Since download can take time, for it to be non-blocking, moved the call to a separate thread.
This commit is contained in:
torrmal
2014-03-26 11:58:26 -04:00
committed by Ian Clelland
parent 449df55848
commit 223d08626d
+6 -2
View File
@@ -430,8 +430,12 @@ static CFIndex WriteDataToStream(NSData* data, CFWriteStreamRef stream)
@synchronized (activeTransfers) {
activeTransfers[delegate.objectId] = delegate;
}
[delegate.connection start];
// Downloads can take time
// sending this to a new thread calling the download_async method
dispatch_async(
dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, (unsigned long)NULL),
^(void) { [delegate.connection start];}
);
}
- (NSMutableDictionary*)createFileTransferError:(int)code AndSource:(NSString*)source AndTarget:(NSString*)target