Merge pull request #218 from tifroz/master

Fixed async handler crash under Swift 2
This commit is contained in:
Pierre-Olivier Latour
2015-09-21 15:20:48 -07:00
2 changed files with 2 additions and 2 deletions
+1 -1
View File
@@ -759,7 +759,7 @@ static inline NSUInteger _ScanHexNumber(const void* bytes, NSUInteger size) {
- (void)processRequest:(GCDWebServerRequest*)request completion:(GCDWebServerCompletionBlock)completion {
GWS_LOG_DEBUG(@"Connection on socket %i processing request \"%@ %@\" with %lu bytes body", _socket, _virtualHEAD ? @"HEAD" : _request.method, _request.path, (unsigned long)_bytesRead);
@try {
_handler.asyncProcessBlock(request, completion);
_handler.asyncProcessBlock(request, [completion copy]);
}
@catch (NSException* exception) {
GWS_LOG_EXCEPTION(exception);
+1 -1
View File
@@ -242,7 +242,7 @@
- (void)performReadDataWithCompletion:(GCDWebServerBodyReaderCompletionBlock)block {
if ([_reader respondsToSelector:@selector(asyncReadDataWithCompletion:)]) {
[_reader asyncReadDataWithCompletion:block];
[_reader asyncReadDataWithCompletion:[block copy]];
} else {
NSError* error = nil;
NSData* data = [_reader readData:&error];