Skip to content

Commit

Permalink
Remove unused variable
Browse files Browse the repository at this point in the history
  • Loading branch information
acb-mv authored and buggmagnet committed Sep 18, 2024
1 parent dee9d4e commit e90f94d
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 10 deletions.
8 changes: 3 additions & 5 deletions ios/PacketTunnelCore/Pinger/TunnelPinger.swift
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,7 @@ public final class TunnelPinger: PingerProtocol {
}
}

var socketHandle: Int32?

var pingProvider: ICMPPingProvider
private var pingProvider: ICMPPingProvider

private let logger: Logger

Expand All @@ -44,7 +42,7 @@ public final class TunnelPinger: PingerProtocol {
self.pingQueue = DispatchQueue(label: "PacketTunnel.icmp")
self.logger = Logger(label: "TunnelPinger")
}

deinit {
pingProvider.closeICMP()
}
Expand All @@ -68,6 +66,7 @@ public final class TunnelPinger: PingerProtocol {
let reply: PingerReply
do {
try pingProvider.sendICMPPing(seqNumber: sequenceNumber)
// NOTE: we cheat here by returning the destination address we were passed, rather than parsing it from the packet on the other side of the FFI boundary.
reply = .success(destAddress, sequenceNumber)
} catch {
reply = .parseError(error)
Expand All @@ -76,7 +75,6 @@ public final class TunnelPinger: PingerProtocol {

replyQueue.async { [weak self] in
guard let self else { return }
// NOTE: we cheat here by returning the destination address we were passed, rather than parsing it from the packet on the other side of the FFI boundary.
self.onReply?(reply)
}
}
Expand Down
2 changes: 1 addition & 1 deletion ios/PacketTunnelCore/TunnelMonitor/TunnelMonitor.swift
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ public final class TunnelMonitor: TunnelMonitorProtocol {
nslock.lock()
defer { nslock.unlock() }

guard let probeAddress, let newStats = getStats(),
guard let newStats = getStats(),
state.connectionState == .connecting || state.connectionState == .connected
else { return }

Expand Down
4 changes: 2 additions & 2 deletions ios/PacketTunnelCoreTests/Mocks/PingerMock.swift
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ class PingerMock: PingerProtocol {

networkStatsReporting.reportBytesSent(UInt64(icmpPacketSize))

return PingerSendResult(sequenceNumber: nextSequenceId, bytesSent: icmpPacketSize)
return PingerSendResult(sequenceNumber: nextSequenceId)
}

// MARK: - Types
Expand All @@ -96,7 +96,7 @@ class PingerMock: PingerProtocol {
var sequenceId: UInt16 = 0
var isSocketOpen = false
var onReply: ((PingerReply) -> Void)?
var destAddress: IPv4Address? = nil
var destAddress: IPv4Address?

mutating func incrementSequenceId() -> UInt16 {
sequenceId += 1
Expand Down
4 changes: 2 additions & 2 deletions ios/PacketTunnelCoreTests/PingerTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ final class PingerTests: XCTestCase {
}
}

try pinger.openSocket(bindTo: "lo0")
sendResult = try pinger.send(to: .loopback)
try pinger.openSocket(bindTo: "lo0", destAddress: .loopback)
sendResult = try pinger.send()

waitForExpectations(timeout: .UnitTest.timeout)
}
Expand Down

0 comments on commit e90f94d

Please sign in to comment.