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,18 +94,17 @@ static ssize_t do_read(const void *ctx, const unsigned char *buf, size_t len)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (wrapper.packets.count == 0) {
|
if (!wrapper.packets.count) {
|
||||||
|
[wrapper.packetFlow readPacketsWithCompletionHandler:^(NSArray<NSData *> * _Nonnull packets, NSArray<NSNumber *> * _Nonnull protocols) {
|
||||||
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_HIGH, 0), ^{
|
[wrapper.condition signal];
|
||||||
[wrapper.packetFlow readPacketsWithCompletionHandler:^(NSArray<NSData *> * _Nonnull packets, NSArray<NSNumber *> * _Nonnull protocols) {
|
[wrapper.packets addObjectsFromArray:packets];
|
||||||
[wrapper.packets addObjectsFromArray:packets];
|
[wrapper.protocols addObjectsFromArray:protocols];
|
||||||
[wrapper.protocols addObjectsFromArray:protocols];
|
os_log_debug([WireGuardGoWrapper log], "do_read - signal - on thread \"%{public}@\" - %d", NSThread.currentThread.name, (int)NSThread.currentThread);
|
||||||
os_log_debug([WireGuardGoWrapper log], "do_read - signal - on thread \"%{public}@\" - %d", NSThread.currentThread.name, (int)NSThread.currentThread);
|
[wrapper.condition signal];
|
||||||
[wrapper.condition signal];
|
}];
|
||||||
}];
|
|
||||||
});
|
|
||||||
os_log_debug([WireGuardGoWrapper log], "do_read - wait - on thread \"%{public}@\" - %d", NSThread.currentThread.name, (int)NSThread.currentThread);
|
os_log_debug([WireGuardGoWrapper log], "do_read - wait - on thread \"%{public}@\" - %d", NSThread.currentThread.name, (int)NSThread.currentThread);
|
||||||
[wrapper.condition wait];
|
while (!wrapper.packets.count)
|
||||||
|
[wrapper.condition wait];
|
||||||
}
|
}
|
||||||
|
|
||||||
NSData *packet = [wrapper.packets objectAtIndex:0];
|
NSData *packet = [wrapper.packets objectAtIndex:0];
|
||||||
|
|
Loading…
Reference in New Issue