NIO: ignore `SIGPIPE` on Windows (#1653)
Windows does not support Unix-style signals. Simply exclude the SIGPIPE path on Windows. Co-authored-by: Cory Benfield <lukasa@apple.com>
This commit is contained in:
parent
2d913d65af
commit
bc328cd3a8
|
@ -351,7 +351,11 @@ class BaseSocket: BaseSocketProtocol {
|
|||
do {
|
||||
try self.ignoreSIGPIPE()
|
||||
} catch {
|
||||
#if os(Windows)
|
||||
self.descriptor = INVALID_SOCKET // We have to unset the fd here, otherwise we'll crash with "leaking open BaseSocket"
|
||||
#else
|
||||
self.descriptor = -1 // We have to unset the fd here, otherwise we'll crash with "leaking open BaseSocket"
|
||||
#endif
|
||||
throw error
|
||||
}
|
||||
}
|
||||
|
|
|
@ -85,6 +85,7 @@ extension BaseSocketProtocol {
|
|||
guard haveWeIgnoredSIGPIEThisIsHereToTriggerIgnoringIt else {
|
||||
fatalError("BUG in NIO. We did not ignore SIGPIPE, this code path should definitely not be reachable.")
|
||||
}
|
||||
#elseif os(Windows)
|
||||
#else
|
||||
assert(fd >= 0, "illegal file descriptor \(fd)")
|
||||
do {
|
||||
|
|
Loading…
Reference in New Issue