Skip to content

Commit

Permalink
Fix some issues with progress create by last changeset
Browse files Browse the repository at this point in the history
  • Loading branch information
pokeb committed May 16, 2009
1 parent 8c2584d commit 7aca62d
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 15 deletions.
17 changes: 2 additions & 15 deletions Classes/ASIHTTPRequest.m
Expand Up @@ -398,16 +398,14 @@ - (void)startRequest
lastBytesRead = 0;

// If we're retrying a request after an authentication failure, let's remove any progress we made
if (lastBytesSent > 0 && uploadProgressDelegate) {
if (lastBytesSent > 0) {
[self removeUploadProgressSoFar];
}

lastBytesSent = 0;
if (shouldResetProgressIndicators) {
contentLength = 0;
if (downloadProgressDelegate) {
[self resetDownloadProgress:0];
}
[self resetDownloadProgress:0];
}
[self setResponseHeaders:nil];
if (![self downloadDestinationPath]) {
Expand Down Expand Up @@ -633,17 +631,6 @@ - (void)resetUploadProgress:(unsigned long long)value
{
[progressLock lock];

//We're using a progress queue or compatible controller to handle progress
SEL selector = @selector(incrementUploadSizeBy:);
if ([queue respondsToSelector:selector]) {
NSMethodSignature *signature = [[queue class] instanceMethodSignatureForSelector:selector];
NSInvocation *invocation = [NSInvocation invocationWithMethodSignature:signature];
[invocation setTarget:queue];
[invocation setSelector:selector];
[invocation setArgument:&value atIndex:2];
[invocation invoke];
}

// Request this request's own upload progress delegate
if (uploadProgressDelegate) {
[ASIHTTPRequest setProgress:0 forProgressIndicator:uploadProgressDelegate];
Expand Down
2 changes: 2 additions & 0 deletions Classes/ASINetworkQueue.m
Expand Up @@ -137,6 +137,7 @@ - (void)addOperation:(NSOperation *)operation

//Tell the request not to reset the progress indicator when it gets a content-length, as we will get the length from the HEAD request
[request setShouldResetProgressIndicators:NO];

[request addDependency:HEADRequest];

// If we want to track uploading for this request accurately, we need to add the size of the post content to the total
Expand All @@ -146,6 +147,7 @@ - (void)addOperation:(NSOperation *)operation
}
}
[request setShowAccurateProgress:showAccurateProgress];


[request setQueue:self];
[super addOperation:request];
Expand Down

0 comments on commit 7aca62d

Please sign in to comment.