Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Make handleRequestForPath:withConnection run on UI thread

  • Loading branch information...
commit fc0fdc90648b951b270c4e0068fada3988352823 1 parent 75efaf5
@soutaro soutaro authored
Showing with 6 additions and 2 deletions.
  1. +6 −2 src/RequestRouter.m
View
8 src/RequestRouter.m
@@ -62,9 +62,13 @@ - (void) registerRoute: (id<Route>) route {
- (NSObject<HTTPResponse> *) handleRequestForPath:(NSString *)path withConnection:(RoutingHTTPConnection *)connection {
NSArray *pathComponents = [self pathComponentsWithPath:path];
- NSObject<HTTPResponse> *response = nil;
+ __block NSObject<HTTPResponse> *response = nil;
for (id<Route> route in _routes) {
- response = [route handleRequestForPath:pathComponents withConnection:connection];
+ dispatch_sync(dispatch_get_main_queue(), ^{
+ response = [[route handleRequestForPath:pathComponents withConnection:connection] retain];
+ });
+ [response autorelease];
+
if( nil != response )
break;
}
Please sign in to comment.
Something went wrong with that request. Please try again.