Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Removed the unnecessary didtimeout selector, I will handle timeouts b…
…y setting max timeouts to 1 and handling timeouts manually.
  • Loading branch information
pellet committed Jul 12, 2011
1 parent ffc35d4 commit aac364e
Show file tree
Hide file tree
Showing 4 changed files with 3 additions and 25 deletions.
7 changes: 0 additions & 7 deletions Classes/ASIHTTPRequest.h
Expand Up @@ -314,9 +314,6 @@ typedef void (^ASIDataBlock)(NSData *data);
// If you set this and implement the method in your delegate, you must handle the data yourself - ASIHTTPRequest will not populate responseData or write the data to downloadDestinationPath
SEL didReceiveDataSelector;

// Called on the delegate (if implemented) when the request times out. Default is requestTimedOut:
SEL didTimeOutSelector;

// Used for recording when something last happened during the request, we will compare this value with the current date to time out requests when appropriate
NSDate *lastActivityTime;

Expand Down Expand Up @@ -671,9 +668,6 @@ typedef void (^ASIDataBlock)(NSData *data);
// Otherwise, returns NO, and nothing will happen
- (BOOL)retryUsingNewConnection;

// Called when a request times out, lets the delgate know via didTimeOutSelector
- (void)requestTimedOut;

// Can be called by delegates from inside their willRedirectSelector implementations to restart the request with a new url
- (void)redirectToURL:(NSURL *)newURL;

Expand Down Expand Up @@ -938,7 +932,6 @@ typedef void (^ASIDataBlock)(NSData *data);
@property (assign) SEL didFinishSelector;
@property (assign) SEL didFailSelector;
@property (assign) SEL didReceiveDataSelector;
@property (assign) SEL didTimeOutSelector;
@property (retain,readonly) NSString *authenticationRealm;
@property (retain,readonly) NSString *proxyAuthenticationRealm;
@property (retain) NSError *error;
Expand Down
12 changes: 1 addition & 11 deletions Classes/ASIHTTPRequest.m
Expand Up @@ -304,7 +304,6 @@ - (id)initWithURL:(NSURL *)newURL
[self setDidFinishSelector:@selector(requestFinished:)];
[self setDidFailSelector:@selector(requestFailed:)];
[self setDidReceiveDataSelector:@selector(request:didReceiveData:)];
[self setDidTimeOutSelector:@selector(requestTimedOut:)];
[self setURL:newURL];
[self setCancelledLock:[[[NSRecursiveLock alloc] init] autorelease]];
[self setDownloadCache:[[self class] defaultCache]];
Expand Down Expand Up @@ -1491,8 +1490,7 @@ - (void)checkRequestStatus

[self performThrottling];

if ([self shouldTimeOut]) {
[self requestTimedOut];
if ([self shouldTimeOut]) {
// Do we need to auto-retry this request?
if ([self numberOfTimesToRetryOnTimeout] > [self retryCount]) {

Expand Down Expand Up @@ -1987,12 +1985,6 @@ - (void)requestWillRedirectToURL:(NSURL *)newURL
}
}

- (void)requestTimedOut
{
// [self callSelectorOnMainThread:&didTimeOutSelector forDelegate:&delegate];
[delegate performSelector:didTimeOutSelector withObject:self];
}

// Subclasses might override this method to process the result in the same thread
// If you do this, don't forget to call [super requestFinished] to let the queue / delegate know we're done
- (void)requestFinished
Expand Down Expand Up @@ -4088,7 +4080,6 @@ - (id)copyWithZone:(NSZone *)zone
[newRequest setDidFinishSelector:[self didFinishSelector]];
[newRequest setDidFailSelector:[self didFailSelector]];
[newRequest setDidReceiveDataSelector:[self didReceiveDataSelector]];
[newRequest setDidTimeOutSelector:[self didTimeOutSelector]];
[newRequest setTimeOutSeconds:[self timeOutSeconds]];
[newRequest setShouldResetDownloadProgress:[self shouldResetDownloadProgress]];
[newRequest setShouldResetUploadProgress:[self shouldResetUploadProgress]];
Expand Down Expand Up @@ -5006,7 +4997,6 @@ - (void)setRequestRedirectedBlock:(ASIBasicBlock)aRedirectBlock
@synthesize didFinishSelector;
@synthesize didFailSelector;
@synthesize didReceiveDataSelector;
@synthesize didTimeOutSelector;
@synthesize authenticationRealm;
@synthesize proxyAuthenticationRealm;
@synthesize error;
Expand Down
5 changes: 0 additions & 5 deletions Classes/ASIHTTPRequestDelegate.h
Expand Up @@ -26,11 +26,6 @@
// You can have the request call a different method by setting didReceiveDataSelector
- (void)request:(ASIHTTPRequest *)request didReceiveData:(NSData *)data;

// If the delegate implements this method, the will call this method on a time out
// This method is useful when the didReceiveData method was implemented on the delegate and the data
// is required to be refreshed on before a retry
- (void)requestTimedOut:(ASIHTTPRequest *)request;

// If a delegate implements one of these, it will be asked to supply credentials when none are available
// The delegate can then either restart the request ([request retryUsingSuppliedCredentials]) once credentials have been set
// or cancel it ([request cancelAuthentication])
Expand Down
4 changes: 2 additions & 2 deletions Classes/Tests/ASIHTTPRequestTests.m
Expand Up @@ -554,7 +554,7 @@ - (void)testResumeChecksContentRangeHeader

// Cancel the request as soon as it has downloaded 64KB
while (1) {
sleep((Float32)0.5);
sleep(0.5);
if ([request totalBytesRead] > 32*1024) {
[request cancel];
break;
Expand All @@ -579,7 +579,7 @@ - (void)testResumeChecksContentRangeHeader
[request startAsynchronous];

while (1) {
sleep((Float32)0.5);
sleep(0.5);
if ([request isFinished]) {
break;
}
Expand Down

0 comments on commit aac364e

Please sign in to comment.