summaryrefslogtreecommitdiff
path: root/SmartDeviceLink/SDLUploadFileOperation.m
diff options
context:
space:
mode:
authorJoel Fischer <joeljfischer@gmail.com>2016-08-18 15:29:15 -0400
committerJoel Fischer <joeljfischer@gmail.com>2016-08-18 15:29:15 -0400
commitf026b1e68abd59b91126a8892ffd26fa4e895166 (patch)
tree4a597382943493cd97551e09f53fcea1742cc55a /SmartDeviceLink/SDLUploadFileOperation.m
parent054b4789a82a74a7d47c31ee60dee16e535354d9 (diff)
downloadsdl_ios-f026b1e68abd59b91126a8892ffd26fa4e895166.tar.gz
Update to v4.3.0-beta.24.3.0-beta.2
Diffstat (limited to 'SmartDeviceLink/SDLUploadFileOperation.m')
-rw-r--r--SmartDeviceLink/SDLUploadFileOperation.m77
1 files changed, 39 insertions, 38 deletions
diff --git a/SmartDeviceLink/SDLUploadFileOperation.m b/SmartDeviceLink/SDLUploadFileOperation.m
index f20616903..ec25ae877 100644
--- a/SmartDeviceLink/SDLUploadFileOperation.m
+++ b/SmartDeviceLink/SDLUploadFileOperation.m
@@ -89,45 +89,46 @@ NS_ASSUME_NONNULL_BEGIN
for (SDLPutFile *putFile in putFiles) {
dispatch_group_enter(putFileGroup);
__weak typeof(self) weakself = self;
- [self.connectionManager sendManagerRequest:putFile withCompletionHandler:^(__kindof SDLRPCRequest *_Nullable request, __kindof SDLRPCResponse *_Nullable response, NSError *_Nullable error) {
- typeof(weakself) strongself = weakself;
- // If we've already encountered an error, then just abort
- // TODO: Is this the right way to handle this case? Should we just abort everything in the future? Should we be deleting what we sent? Should we have an automatic retry strategy based on what the error was?
- if (strongself.isCancelled) {
- stop = YES;
- }
-
- if (stop) {
- dispatch_group_leave(putFileGroup);
- BLOCK_RETURN;
- }
-
- // If we encounted an error, abort in the future and call the completion handler
- if (error != nil || response == nil || ![response.success boolValue]) {
- stop = YES;
- streamError = error;
-
- if (completion != nil) {
- completion(NO, 0, error);
- }
-
- dispatch_group_leave(putFileGroup);
- BLOCK_RETURN;
- }
-
- // If we haven't encounted an error
- SDLPutFileResponse *putFileResponse = (SDLPutFileResponse *)response;
-
- // We need to do this to make sure our bytesAvailable is accurate
- if ([request.correlationID integerValue] > highestCorrelationIDReceived) {
- highestCorrelationIDReceived = [request.correlationID integerValue];
- bytesAvailable = [putFileResponse.spaceAvailable unsignedIntegerValue];
- }
-
- dispatch_group_leave(putFileGroup);
- }];
+ [self.connectionManager sendManagerRequest:putFile
+ withCompletionHandler:^(__kindof SDLRPCRequest *_Nullable request, __kindof SDLRPCResponse *_Nullable response, NSError *_Nullable error) {
+ typeof(weakself) strongself = weakself;
+ // If we've already encountered an error, then just abort
+ // TODO: Is this the right way to handle this case? Should we just abort everything in the future? Should we be deleting what we sent? Should we have an automatic retry strategy based on what the error was?
+ if (strongself.isCancelled) {
+ stop = YES;
+ }
+
+ if (stop) {
+ dispatch_group_leave(putFileGroup);
+ BLOCK_RETURN;
+ }
+
+ // If we encounted an error, abort in the future and call the completion handler
+ if (error != nil || response == nil || ![response.success boolValue]) {
+ stop = YES;
+ streamError = error;
+
+ if (completion != nil) {
+ completion(NO, 0, error);
+ }
+
+ dispatch_group_leave(putFileGroup);
+ BLOCK_RETURN;
+ }
+
+ // If we haven't encounted an error
+ SDLPutFileResponse *putFileResponse = (SDLPutFileResponse *)response;
+
+ // We need to do this to make sure our bytesAvailable is accurate
+ if ([request.correlationID integerValue] > highestCorrelationIDReceived) {
+ highestCorrelationIDReceived = [request.correlationID integerValue];
+ bytesAvailable = [putFileResponse.spaceAvailable unsignedIntegerValue];
+ }
+
+ dispatch_group_leave(putFileGroup);
+ }];
}
-
+
dispatch_group_leave(putFileGroup);
}