Private
Public Access
1
0

Batch updates, and fixing bug where daemon would crash when accessing IMCore stuff from different threads

This commit is contained in:
James Magahern
2018-11-21 15:51:51 -07:00
parent 3186f1948a
commit dba4910a82
10 changed files with 155 additions and 90 deletions

View File

@@ -32,6 +32,17 @@
return operationClassMapping;
}
+ (dispatch_queue_t)sharedIMAccessQueue
{
static dispatch_once_t onceToken;
static dispatch_queue_t accessQueue = nil;
dispatch_once(&onceToken, ^{
accessQueue = dispatch_queue_create("IMAccessQueue", DISPATCH_QUEUE_SERIAL);
});
return accessQueue;
}
+ (void)load
{
if ([self class] != [MBIMBridgeOperation class]) {
@@ -61,4 +72,20 @@
return [[HTTPErrorResponse alloc] initWithErrorCode:500];
}
- (NSString *)valueForQueryItemWithName:(NSString *)queryItemName
{
NSURLComponents *urlComponents = [NSURLComponents componentsWithURL:self.requestURL
resolvingAgainstBaseURL:NO];
NSString *value = nil;
for (NSURLQueryItem *queryItem in [urlComponents queryItems]) {
if ([[queryItem name] isEqualToString:queryItemName]) {
value = [queryItem value];
break;
}
}
return value;
}
@end