mirror of
https://github.com/passepartoutvpn/wireguard-apple.git
synced 2025-02-16 12:52:06 +00:00
Prevent signal and wait from racing
This commit is contained in:
parent
75a86c7cce
commit
fcd5923cbc
@ -181,7 +181,7 @@ class WireGuardContext {
|
||||
private var packetFlow: NEPacketTunnelFlow
|
||||
private var outboundPackets: [NEPacket] = []
|
||||
private var isTunnelClosed: Bool = false
|
||||
private let readPacketCondition = NSCondition()
|
||||
private var readPacketCondition = NSCondition()
|
||||
|
||||
init(packetFlow: NEPacketTunnelFlow) {
|
||||
self.packetFlow = packetFlow
|
||||
@ -193,7 +193,9 @@ class WireGuardContext {
|
||||
}
|
||||
|
||||
func packetsRead(packets: [NEPacket]) {
|
||||
readPacketCondition.lock()
|
||||
outboundPackets.append(contentsOf: packets)
|
||||
readPacketCondition.unlock()
|
||||
readPacketCondition.signal()
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user