From f93634bd7a0804556f82d28d988a1e145a0627d9 Mon Sep 17 00:00:00 2001 From: Davide De Rosa Date: Sun, 21 Oct 2018 14:07:37 +0200 Subject: [PATCH] Respect link MTU in TCP Mitigates #39 --- .../Sources/AppExtension/Transport/NETCPInterface.swift | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/TunnelKit/Sources/AppExtension/Transport/NETCPInterface.swift b/TunnelKit/Sources/AppExtension/Transport/NETCPInterface.swift index c6ece48..e74f4ae 100644 --- a/TunnelKit/Sources/AppExtension/Transport/NETCPInterface.swift +++ b/TunnelKit/Sources/AppExtension/Transport/NETCPInterface.swift @@ -106,7 +106,7 @@ class NETCPSocket: NSObject, GenericSocket { } func link(withMTU mtu: Int) -> LinkInterface { - return NETCPLink(impl: impl) + return NETCPLink(impl: impl, mtu: mtu) } // MARK: Connection KVO (any queue) @@ -181,9 +181,9 @@ class NETCPLink: LinkInterface { private let maxPacketSize: Int - init(impl: NWTCPConnection, maxPacketSize: Int? = nil) { + init(impl: NWTCPConnection, mtu: Int, maxPacketSize: Int? = nil) { self.impl = impl - self.mtu = .max + self.mtu = mtu self.maxPacketSize = maxPacketSize ?? (512 * 1024) }