Warn about discarded received packets

This commit is contained in:
Davide De Rosa 2019-12-12 09:32:34 +01:00
parent a65682a89a
commit 90c118a3d0
1 changed files with 3 additions and 1 deletions

View File

@ -437,6 +437,7 @@ public class OpenVPNSession: Session {
// Ruby: recv_link
private func receiveLink(packets: [Data]) {
guard shouldHandlePackets() else {
log.warning("Discarding \(packets.count) LINK packets (should not handle)")
return
}
@ -536,6 +537,7 @@ public class OpenVPNSession: Session {
// Ruby: recv_tun
private func receiveTunnel(packets: [Data]) {
guard shouldHandlePackets() else {
log.warning("Discarding \(packets.count) TUN packets (should not handle)")
return
}
sendDataPackets(packets)
@ -1221,7 +1223,7 @@ public class OpenVPNSession: Session {
// MARK: Stop
private func shouldHandlePackets() -> Bool {
return (!isStopping && !keys.isEmpty)
return !isStopping && !keys.isEmpty
}
private func deferStop(_ method: StopMethod, _ error: Error?) {