mirror of https://github.com/axmolengine/axmol.git
connError added
This commit is contained in:
parent
753335726a
commit
3811c9f1a3
|
@ -46,6 +46,7 @@
|
|||
@property (readonly) NSString *statusString;
|
||||
|
||||
@property (strong) NSError *responseError;
|
||||
@property (strong) NSError *connError;
|
||||
|
||||
@property (strong) NSURLConnection *conn;
|
||||
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Reference in New Issue