mirror of
https://github.com/zhigang1992/react-native.git
synced 2026-04-24 04:16:00 +08:00
Avoid dispatching network callbacks when already on the right queue
Reviewed By: mmmulani Differential Revision: D3690133 fbshipit-source-id: a1769016a05b3163a3b1c93f448864aeaecc6e46
This commit is contained in:
committed by
Facebook Github Bot 7
parent
66bea7d1e5
commit
0b1954cace
@@ -9,6 +9,8 @@
|
||||
|
||||
#import "RCTHTTPRequestHandler.h"
|
||||
|
||||
#import "RCTNetworking.h"
|
||||
|
||||
@interface RCTHTTPRequestHandler () <NSURLSessionDataDelegate>
|
||||
|
||||
@end
|
||||
@@ -19,6 +21,8 @@
|
||||
NSURLSession *_session;
|
||||
}
|
||||
|
||||
@synthesize bridge = _bridge;
|
||||
|
||||
RCT_EXPORT_MODULE()
|
||||
|
||||
- (void)invalidate
|
||||
@@ -55,6 +59,7 @@ RCT_EXPORT_MODULE()
|
||||
|
||||
NSOperationQueue *callbackQueue = [NSOperationQueue new];
|
||||
callbackQueue.maxConcurrentOperationCount = 1;
|
||||
callbackQueue.underlyingQueue = [[_bridge networking] methodQueue];
|
||||
NSURLSessionConfiguration *configuration = [NSURLSessionConfiguration defaultSessionConfiguration];
|
||||
_session = [NSURLSession sessionWithConfiguration:configuration
|
||||
delegate:self
|
||||
|
||||
Reference in New Issue
Block a user