Skip to content

Commit

Permalink
share udp dns queue
Browse files Browse the repository at this point in the history
  • Loading branch information
YangSen-qn committed Jun 1, 2022
1 parent b24b2ad commit 1b0ca6b
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion HappyDNS/Dns/QNDnsUdpResolver.m
Original file line number Diff line number Diff line change
Expand Up @@ -69,9 +69,18 @@ + (instancetype)resolverWithServerIPs:(NSArray <NSString *> *)servers
return resolver;
}

+ (dispatch_queue_t)defaultQueue {
static dispatch_once_t onceToken;
static dispatch_queue_t timerQueue;
dispatch_once(&onceToken, ^{
timerQueue = dispatch_queue_create("com.qiniu.dns.udp.queue", DISPATCH_QUEUE_CONCURRENT);
});
return timerQueue;
}

- (dispatch_queue_t)queue {
if (_queue == nil) {
_queue = dispatch_queue_create("com.qiniu.dns.server.queue", DISPATCH_QUEUE_CONCURRENT);
_queue = [QNDnsUdpResolver defaultQueue];
}
return _queue;
}
Expand Down

0 comments on commit 1b0ca6b

Please sign in to comment.