connError added

This commit is contained in:
byeonggee.seo 2015-03-03 16:33:35 +09:00
parent 753335726a
commit 3811c9f1a3
3 changed files with 12 additions and 2 deletions

View File

@ -46,6 +46,7 @@
@property (readonly) NSString *statusString;
@property (strong) NSError *responseError;
@property (strong) NSError *connError;
@property (strong) NSURLConnection *conn;

View File

@ -34,6 +34,7 @@
@synthesize responseCode;
@synthesize statusString;
@synthesize responseError;
@synthesize connError;
@synthesize conn;
@synthesize finish;
@synthesize runLoop;
@ -46,6 +47,7 @@
responseData = [NSMutableData new];
getDataTime = 0;
responseError = nil;
connError = nil;
// create the connection with the target request and this class as the delegate
self.conn = [[NSURLConnection alloc] initWithRequest:request
@ -118,7 +120,7 @@
didFailWithError:(NSError *)error
{
//NSLog(@"Load failed with error %@", [error localizedDescription]);
responseError = [error copy];
connError = [error copy];
finish = true;
}

View File

@ -243,11 +243,18 @@ static int processTask(HttpRequest *request, NSString* requestType, void *stream
}
//if http connection return error
if (httpAsynConn.connError != nil)
{
NSString* errorString = [httpAsynConn.connError localizedDescription];
strcpy(errorBuffer, [errorString UTF8String]);
return 0;
}
//if http response got error, just log the error
if (httpAsynConn.responseError != nil)
{
NSString* errorString = [httpAsynConn.responseError localizedDescription];
strcpy(errorBuffer, [errorString UTF8String]);
return 0;
}
*responseCode = httpAsynConn.responseCode;