Drop UDP packets on no buffer space available

Tolerate only on data channel. Control channel should never reach
high speeds.

Fixes #87
This commit is contained in:
Davide De Rosa 2019-04-25 17:28:29 +02:00
parent 4acf7f3b49
commit 6fb409b112
2 changed files with 8 additions and 0 deletions

View File

@ -16,6 +16,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- SoftEther sends an incomplete PUSH_REPLY. [#86](https://github.com/keeshux/tunnelkit/issues/86)
- Authentication/Decrypt errors with TLS wrapping. [#88](https://github.com/keeshux/tunnelkit/issues/88), [#61](https://github.com/keeshux/tunnelkit/issues/61)
- Broken DNS when no servers provided. [#84](https://github.com/keeshux/tunnelkit/issues/84)
- UDP may disconnect on high-speed upload link. [#87](https://github.com/keeshux/tunnelkit/issues/87)
## 1.6.2 (2019-04-17)

View File

@ -1143,6 +1143,13 @@ public class SessionProxy {
controlChannel.addSentDataCount(encryptedPackets.flatCount)
link?.writePackets(encryptedPackets) { [weak self] (error) in
if let error = error {
// try mitigating "No buffer space available"
if let posixError = error as? POSIXError, posixError.code == POSIXErrorCode.ENOBUFS {
log.warning("Data: Packets dropped, no buffer space available")
return
}
self?.queue.sync {
log.error("Data: Failed LINK write during send data: \(error)")
self?.deferStop(.shutdown, SessionError.failedLinkWrite)