bridge: don't put on another thread
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
This commit is contained in:
parent
a81e8dcf3c
commit
76a001dbe0
|
@ -94,17 +94,16 @@ static ssize_t do_read(const void *ctx, const unsigned char *buf, size_t len)
|
|||
return 0;
|
||||
}
|
||||
|
||||
if (wrapper.packets.count == 0) {
|
||||
|
||||
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_HIGH, 0), ^{
|
||||
if (!wrapper.packets.count) {
|
||||
[wrapper.packetFlow readPacketsWithCompletionHandler:^(NSArray<NSData *> * _Nonnull packets, NSArray<NSNumber *> * _Nonnull protocols) {
|
||||
[wrapper.condition signal];
|
||||
[wrapper.packets addObjectsFromArray:packets];
|
||||
[wrapper.protocols addObjectsFromArray:protocols];
|
||||
os_log_debug([WireGuardGoWrapper log], "do_read - signal - on thread \"%{public}@\" - %d", NSThread.currentThread.name, (int)NSThread.currentThread);
|
||||
[wrapper.condition signal];
|
||||
}];
|
||||
});
|
||||
os_log_debug([WireGuardGoWrapper log], "do_read - wait - on thread \"%{public}@\" - %d", NSThread.currentThread.name, (int)NSThread.currentThread);
|
||||
while (!wrapper.packets.count)
|
||||
[wrapper.condition wait];
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue