mirror of
https://github.com/apple/swift-nio
synced 2026-11-30 05:28:44 +00:00
No need to convert to IOError if EWOULDBLOCK
This commit is contained in:
1 parent
ec47eb0677
commit
9b79aba3b2
1 file changed
+4
-4
@@ -55,12 +55,12 @@ func wrapSyscall(_ successCondition: (Int) -> Bool,
|
||||
func wrapSyscallMayBlock(_ successCondition: (Int) -> Bool,
|
||||
function: @autoclosure () -> String, _ fn: () -> Int) throws -> Int? {
|
||||
do {
|
||||
return try wrapSyscall(function: function, successCondition, fn)
|
||||
} catch let error as IOError {
|
||||
if error.errno == EWOULDBLOCK {
|
||||
return try withErrno(hint: "", successCondition: successCondition, fn)
|
||||
} catch let e as POSIXReasonedError {
|
||||
if e.code == EWOULDBLOCK {
|
||||
return nil;
|
||||
}
|
||||
throw error
|
||||
throw ioError(errno: e.code, function: function())
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user