Added support for asynchronous reading in GCDWebServerBodyReader

This commit is contained in:
Pierre-Olivier Latour
2014-10-14 12:40:19 -07:00
parent a933b2126e
commit c4bf7b11e2
4 changed files with 71 additions and 45 deletions
+8 -3
View File
@@ -244,9 +244,14 @@
return [_reader open:error];
}
- (NSData*)performReadData:(NSError**)error {
GWS_DCHECK(_opened);
return [_reader readData:error];
- (void)performReadDataWithCompletion:(GCDWebServerBodyReaderCompletionBlock)block {
if ([_reader respondsToSelector:@selector(asyncReadDataWithCompletion:)]) {
[_reader asyncReadDataWithCompletion:block];
} else {
NSError* error = nil;
NSData* data = [_reader readData:&error];
block(data, error);
}
}
- (void)performClose {