Skip to content

Commit 2f4c65a

Browse files
author
garenwang
committed
# 6.3.1
1 parent 37cac7a commit 2f4c65a

File tree

14 files changed

+92
-28
lines changed

14 files changed

+92
-28
lines changed

CHANGELOG.md

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,13 @@
1-
# 6.3.0
2-
优化弱网环境quic链接
1+
# 6.3.1
32

3+
4+
# 6.3.0
5+
6+
修改弱网环境quic链接
7+
48
# 6.2.9
5-
支持AI智能识别
6-
优化部分已有接口
9+
10+
新增AI智能识别
711

812
# 6.2.8
913
支持冷存储

QCloudCOSXML.podspec

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ Pod::Spec.new do |s|
22
s.name = "QCloudCOSXML"
33

44

5-
s.version = "6.3.0"
5+
s.version = "6.3.1"
66

77

88
s.summary = "QCloudCOSXML 腾讯云iOS-SDK组件"
@@ -22,15 +22,15 @@ s.version = "6.3.0"
2222
s.subspec 'Default' do |default|
2323
default.source_files = 'QCloudCOSXML/Classes/**/*','QCloudCOSXML/Classes/QCloudCOSXML/*'
2424

25-
default.dependency "QCloudCore",'6.3.0'
25+
default.dependency "QCloudCore",'6.3.1'
2626
end
2727
s.subspec 'Slim' do |slim|
2828
slim.source_files = 'QCloudCOSXML/Classes/**/*','QCloudCOSXML/Classes/QCloudCOSXML/*'
29-
slim.dependency "QCloudCore/WithoutMTA",'6.3.0'
29+
slim.dependency "QCloudCore/WithoutMTA",'6.3.1'
3030
end
3131
s.subspec 'Transfer' do |transfer|
3232
transfer.source_files = 'QCloudCOSXML/Classes/*','QCloudCOSXML/Classes/Transfer/**/*','QCloudCOSXML/Classes/Base/**/*'
33-
transfer.dependency "QCloudCore/WithoutMTA",'6.3.0'
33+
transfer.dependency "QCloudCore/WithoutMTA",'6.3.1'
3434

3535
end
3636

QCloudCOSXML/Classes/QCloudCOSXMLVersion.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
#ifndef QCloudCOSXMLModuleVersion_h
77
#define QCloudCOSXMLModuleVersion_h
8-
#define QCloudCOSXMLModuleVersionNumber 603000
8+
#define QCloudCOSXMLModuleVersionNumber 603001
99

1010
//dependency
1111

QCloudCOSXML/Classes/QCloudCOSXMLVersion.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#import "QCloudCOSXMLVersion.h"
2-
NSString * const QCloudCOSXMLModuleVersion = @"6.3.0";
2+
NSString * const QCloudCOSXMLModuleVersion = @"6.3.1";
33
NSString * const QCloudCOSXMLModuleName = @"QCloudCOSXML";
44
@interface QCloudQCloudCOSXMLLoad : NSObject
55
@end

QCloudCOSXML/Classes/Transfer/request/QCloudCOSXMLUploadObjectRequest.m

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -465,7 +465,7 @@ - (void)uploadOffsetBodys:(NSArray<QCloudFileOffsetBody *> *)allParts {
465465
dispatch_resume(_queueSource);
466466
for (int i = 0; i < allParts.count; i++) {
467467
__block QCloudFileOffsetBody *body = allParts[i];
468-
468+
469469
//如果自身被取消,终止c创建新的uploadPartRequest
470470
if (self.canceled) {
471471
QCloudLogDebug(@"请求被取消,终止创建新的uploadPartRequest");
@@ -488,19 +488,22 @@ - (void)uploadOffsetBodys:(NSArray<QCloudFileOffsetBody *> *)allParts {
488488
__weak typeof(request) weakRequest = request;
489489
__block int64_t partBytesSent = 0;
490490
int64_t partSize = body.sliceLength;
491+
BOOL isRetry = request.isRetry;
491492
[request setSendProcessBlock:^(int64_t bytesSent, int64_t totalBytesSent, int64_t totalBytesExpectedToSend) {
492-
int64_t restSize = totalBytesExpectedToSend - partSize;
493-
if (restSize - partBytesSent <= 0) {
494-
[weakSelf appendUploadBytesSent:bytesSent];
495-
} else {
496-
partBytesSent += bytesSent;
493+
if(!request.enableQuic || !isRetry){
494+
int64_t restSize = totalBytesExpectedToSend - partSize;
497495
if (restSize - partBytesSent <= 0) {
498-
[weakSelf appendUploadBytesSent:partBytesSent - restSize];
496+
[weakSelf appendUploadBytesSent:bytesSent];
497+
} else {
498+
partBytesSent += bytesSent;
499+
if (restSize - partBytesSent <= 0) {
500+
[weakSelf appendUploadBytesSent:partBytesSent - restSize];
501+
}
499502
}
500503
}
501504
}];
502505
[request setFinishBlock:^(QCloudUploadPartResult *outputObject, NSError *error) {
503-
QCloudLogInfo(@"收到一个part %d的响应 %@", (i + 1), outputObject.eTag);
506+
QCloudLogInfo(@"收到一个part %d的响应 %@;是否重试:", (i + 1), outputObject.eTag, isRetry);
504507
if (!weakSelf) {
505508
return;
506509
}

QCloudCore.podspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ Pod::Spec.new do |s|
1010
s.name = "QCloudCore"
1111

1212

13-
s.version = "6.3.0"
13+
s.version = "6.3.1"
1414

1515

1616

QCloudCore/Classes/Base/QCLOUDRestNet/CoreRequest/Serializer/QCloudResponseSerializer.m

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
typedef id (^QCloudResponseSerializerBlock)(NSHTTPURLResponse *response, id inputData, NSError *__autoreleasing *error);
1616

1717
QCloudResponseSerializerBlock QCloudResponseXMLSerializerBlock = ^(NSHTTPURLResponse *response, id inputData, NSError *__autoreleasing *error) {
18-
QCloudLogDebug(@"response %@", response);
18+
1919
if (![inputData isKindOfClass:[NSData class]]) {
2020
if (NULL != error) {
2121
*error = [NSError qcloud_errorWithCode:QCloudNetworkErrorCodeResponseDataTypeInvalid
@@ -49,6 +49,7 @@
4949
encoding:NSUTF8StringEncoding]]];
5050
return (id)nil;
5151
}
52+
NSLog(@"output = %@", output);
5253
return (id)output;
5354
};
5455

QCloudCore/Classes/Base/QCLOUDRestNet/Retry/QCloudHTTPRetryHanlder.h

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,16 +15,36 @@ typedef void (^QCloudHTTPRetryFunction)(void);
1515

1616
@end
1717

18+
// 配置全局重试策略。
19+
// 开启: openConfig = YES; 并设置 maxCount & sleepStep。
20+
// 关闭: openConfig = NO;
21+
@interface QCloudHTTPRetryConfig : NSObject
22+
23+
@property (nonatomic, assign) NSInteger maxCount;
24+
25+
@property (nonatomic, assign) NSTimeInterval sleepStep;
26+
27+
// 默认未开启,使用 QCloudHTTPRetryHanlder 中的 maxCount&sleepStep。
28+
@property (nonatomic, assign) BOOL openConfig;
29+
30+
+ (QCloudHTTPRetryConfig *)globalRetryConfig;
31+
32+
@end
33+
1834
@interface QCloudHTTPRetryHanlder : NSObject {
1935
@protected
2036
NSSet *_errorCode;
2137
}
2238
+ (QCloudHTTPRetryHanlder *)defaultRetryHandler;
23-
@property (nonatomic, assign) NSInteger maxCount;
39+
2440
@property (nonatomic, weak) id<QCloudHttpRetryHandlerProtocol> delegate;
41+
42+
// 默认使用 QCloudHTTPRetryConfig.maxCount; 默认值 3
43+
@property (nonatomic, assign) NSInteger maxCount;
2544
/**
2645
sleeptime = sleepStep * 1^2 ,
2746
*/
47+
// 默认使用 QCloudHTTPRetryConfig.sleepStep; 默认值 1
2848
@property (nonatomic, assign) NSTimeInterval sleepStep;
2949
- (instancetype)initWithMaxCount:(NSInteger)maxCount sleepTime:(NSTimeInterval)sleepStep;
3050

QCloudCore/Classes/Base/QCLOUDRestNet/Retry/QCloudHTTPRetryHanlder.m

Lines changed: 38 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,28 @@
1010
#import "QCloudNetEnv.h"
1111
#import "QCloudLogger.h"
1212
#import "NSError+QCloudNetworking.h"
13+
14+
@implementation QCloudHTTPRetryConfig
15+
16+
+ (QCloudHTTPRetryConfig *)globalRetryConfig{
17+
static QCloudHTTPRetryConfig * config = nil;
18+
static dispatch_once_t onceToken;
19+
dispatch_once(&onceToken, ^{
20+
config = [[QCloudHTTPRetryConfig alloc]init];
21+
});
22+
return config;
23+
}
24+
25+
- (instancetype)init{
26+
if(self = [super init]){
27+
_maxCount = 0;
28+
_sleepStep = 0;
29+
}
30+
return self;
31+
}
32+
33+
@end
34+
1335
@interface QCloudHTTPRetryHanlder ()
1436
@end
1537

@@ -27,8 +49,8 @@ - (instancetype)initWithMaxCount:(NSInteger)maxCount sleepTime:(NSTimeInterval)s
2749
if (!self) {
2850
return self;
2951
}
30-
_maxCount = maxCount;
3152
_sleepStep = sleepStep;
53+
_maxCount = maxCount;
3254
[self reset];
3355
return self;
3456
}
@@ -60,12 +82,26 @@ - (BOOL)canRetryWhenError:(NSError *)error {
6082
}
6183
}
6284

63-
if (_currentTryCount >= _maxCount) {
85+
if (_currentTryCount >= self.maxCount) {
6486
QCloudLogDebug(@"超过了最大重试次数,不再重试");
6587
return NO;
6688
}
6789

6890
return [NSError isNetworkErrorAndRecoverable:error] || ([error.domain isEqualToString:kQCloudNetworkDomain] && error.code >= 500);
6991
}
7092

93+
- (NSInteger)maxCount{
94+
if(QCloudHTTPRetryConfig.globalRetryConfig.openConfig){
95+
return QCloudHTTPRetryConfig.globalRetryConfig.maxCount;
96+
}
97+
return _maxCount;
98+
}
99+
100+
- (NSTimeInterval)sleepStep{
101+
if(QCloudHTTPRetryConfig.globalRetryConfig.openConfig){
102+
return QCloudHTTPRetryConfig.globalRetryConfig.sleepStep;
103+
}
104+
return _sleepStep;
105+
}
106+
71107
@end

QCloudCore/Classes/Base/QCloudCoreVersion.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
#ifndef QCloudCoreModuleVersion_h
77
#define QCloudCoreModuleVersion_h
8-
#define QCloudCoreModuleVersionNumber 603000
8+
#define QCloudCoreModuleVersionNumber 603001
99

1010
//dependency
1111

0 commit comments

Comments
 (0)