Skip to content

Commit

Permalink
[#39] run the NSURLConnection in the NSConnectionReplyMode rather tha…
Browse files Browse the repository at this point in the history
…n the NSDefaultRunLoopMode
  • Loading branch information
vickeryj committed Feb 10, 2009
1 parent c0a3204 commit dc4fe44
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions Classes/lib/Connection.m
Expand Up @@ -72,11 +72,9 @@ + (Response *)sendRequest:(NSMutableURLRequest *)request withUser:(NSString *)us

//This needs to run in the main run loop in the default mode
[connection unscheduleFromRunLoop:[NSRunLoop currentRunLoop] forMode:NSDefaultRunLoopMode];
[connection scheduleInRunLoop:runLoop forMode:NSDefaultRunLoopMode];
[connection scheduleInRunLoop:runLoop forMode:NSConnectionReplyMode];
[connection start];
while (![connectionDelegate isDone]) {
[runLoop runUntilDate:[NSDate dateWithTimeIntervalSinceNow:.3]];
}
while (![connectionDelegate isDone] && [runLoop runMode:NSConnectionReplyMode beforeDate:[NSDate distantFuture]]);
Response *resp = [Response responseFrom:(NSHTTPURLResponse *)connectionDelegate.response
withBody:connectionDelegate.data
andError:connectionDelegate.error];
Expand Down

0 comments on commit dc4fe44

Please sign in to comment.