summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--ios/PacketTunnel/TunnelMonitor/Pinger.swift4
1 files changed, 2 insertions, 2 deletions
diff --git a/ios/PacketTunnel/TunnelMonitor/Pinger.swift b/ios/PacketTunnel/TunnelMonitor/Pinger.swift
index 60098eb99b..65d5bd9458 100644
--- a/ios/PacketTunnel/TunnelMonitor/Pinger.swift
+++ b/ios/PacketTunnel/TunnelMonitor/Pinger.swift
@@ -132,11 +132,11 @@ final class Pinger {
/// Returns `SendResult` on success, otherwise throws a `Pinger.Error`.
func send(to address: IPv4Address) throws -> SendResult {
stateLock.lock()
+ defer { stateLock.unlock() }
+
guard let socket = socket else {
- stateLock.unlock()
throw Error.closedSocket
}
- stateLock.unlock()
var sa = sockaddr_in()
sa.sin_len = UInt8(MemoryLayout.size(ofValue: sa))