From f90becb2f62c5762ce8b2c16646a0a7d0f4ddc76 Mon Sep 17 00:00:00 2001 From: Diego Waxemberg Date: Fri, 29 May 2015 00:15:48 -0700 Subject: [PATCH] no longer try to parse responses when a network error occurs --- Limelight/Network/HttpManager.m | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/Limelight/Network/HttpManager.m b/Limelight/Network/HttpManager.m index 39f27d3..bc011ea 100644 --- a/Limelight/Network/HttpManager.m +++ b/Limelight/Network/HttpManager.m @@ -23,6 +23,8 @@ NSMutableData* _respData; NSData* _requestResp; dispatch_semaphore_t _requestLock; + + BOOL _errorOccurred; } static const NSString* PORT = @"47984"; @@ -54,9 +56,11 @@ static const NSString* PORT = @"47984"; [NSURLConnection connectionWithRequest:request.request delegate:self]; }); dispatch_semaphore_wait(_requestLock, DISPATCH_TIME_FOREVER); - if (request.response) { + + if (!_errorOccurred && request.response) { [request.response populateWithData:_requestResp]; } + _errorOccurred = false; } - (void) executeRequest:(HttpRequest*)request { @@ -217,6 +221,7 @@ static const NSString* PORT = @"47984"; - (void)connection:(NSURLConnection *)connection didFailWithError:(NSError *)error { Log(LOG_D, @"connection error: %@", error); + _errorOccurred = true; dispatch_semaphore_signal(_requestLock); }