File tree Expand file tree Collapse file tree 1 file changed +13
-9
lines changed
Expand file tree Collapse file tree 1 file changed +13
-9
lines changed Original file line number Diff line number Diff line change 1111
1212@interface QNUpProgress ()
1313
14- @property ( atomic , assign )long long maxProgressUploadBytes;
15- @property ( atomic , assign )long long previousUploadBytes;
14+ @property (nonatomic , assign )long long maxProgressUploadBytes;
15+ @property (nonatomic , assign )long long previousUploadBytes;
1616@property (nonatomic , copy )QNUpProgressHandler progress;
1717@property (nonatomic , copy )QNUpByteProgressHandler byteProgress;
1818
@@ -34,22 +34,26 @@ - (void)progress:(NSString *)key uploadBytes:(long long)uploadBytes totalBytes:(
3434 }
3535
3636 if (totalBytes > 0 ) {
37- if (self.maxProgressUploadBytes < 0 ) {
38- self.maxProgressUploadBytes = totalBytes * 0.95 ;
37+ @synchronized (self) {
38+ if (self.maxProgressUploadBytes < 0 ) {
39+ self.maxProgressUploadBytes = totalBytes * 0.95 ;
40+ }
3941 }
4042
4143 if (uploadBytes > self.maxProgressUploadBytes ) {
4244 return ;
4345 }
4446 }
4547
46- if (uploadBytes > self.previousUploadBytes ) {
47- self.previousUploadBytes = uploadBytes;
48- } else {
49- return ;
48+ @synchronized (self) {
49+ if (uploadBytes > self.previousUploadBytes ) {
50+ self.previousUploadBytes = uploadBytes;
51+ } else {
52+ return ;
53+ }
5054 }
5155
52- [self notify: key uploadBytes: self .previousUploadBytes totalBytes: totalBytes];
56+ [self notify: key uploadBytes: uploadBytes totalBytes: totalBytes];
5357}
5458
5559- (void )notifyDone : (NSString *)key totalBytes : (long long )totalBytes {
You can’t perform that action at this time.
0 commit comments