Skip to content
Browse files

Removed the unnecessary didtimeout selector, I will handle timeouts b…

…y setting max timeouts to 1 and handling timeouts manually.
  • Loading branch information...
1 parent ffc35d4 commit aac364e0b2ce849b480ac1717d92315d4037b347 @pellet committed Jul 12, 2011
Showing with 3 additions and 25 deletions.
  1. +0 −7 Classes/ASIHTTPRequest.h
  2. +1 −11 Classes/ASIHTTPRequest.m
  3. +0 −5 Classes/ASIHTTPRequestDelegate.h
  4. +2 −2 Classes/Tests/ASIHTTPRequestTests.m
View
7 Classes/ASIHTTPRequest.h
@@ -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;
@@ -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;
@@ -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;
View
12 Classes/ASIHTTPRequest.m
@@ -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]];
@@ -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]) {
@@ -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
@@ -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]];
@@ -5006,7 +4997,6 @@ - (void)setRequestRedirectedBlock:(ASIBasicBlock)aRedirectBlock
@synthesize didFinishSelector;
@synthesize didFailSelector;
@synthesize didReceiveDataSelector;
-@synthesize didTimeOutSelector;
@synthesize authenticationRealm;
@synthesize proxyAuthenticationRealm;
@synthesize error;
View
5 Classes/ASIHTTPRequestDelegate.h
@@ -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])
View
4 Classes/Tests/ASIHTTPRequestTests.m
@@ -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;
@@ -579,7 +579,7 @@ - (void)testResumeChecksContentRangeHeader
[request startAsynchronous];
while (1) {
- sleep((Float32)0.5);
+ sleep(0.5);
if ([request isFinished]) {
break;
}

0 comments on commit aac364e

Please sign in to comment.
Something went wrong with that request. Please try again.