mirror of
https://github.com/mii443/wasmer.git
synced 2025-12-07 21:28:21 +00:00
Many bug fixes and performance optimizations
- Removed generation_arena which was causing some serious leakages of files and sockets - Added OsError for NetworkErrors so that "Too Many Open Files" is properly passed - Local networking will now cap at 10 sockets in the backlog - Added the missing shutdown error code - Removed the inodes lock around most of the WASI syscalls - Fixed some race conditions in the event notifications for WASI - The polling loop will now only notify a closed socket once - Event notifications now uses Wakers rather than MPSC - Some socket errors now return the right codes which prevents panics in WASM - Fixed a bug where the file read and write guards might release the file before the lock - The inode seed is now much safer preventing overlaps - The fd seed is now much safer preventing overlaps - Closing files is now implicit rather than explicit reducing possibliities for error - Forking of file descriptors is now much simplier - Polling events will now be returned in random order to prevent some race conditions - Removed a number of memory allocations which were wasting memory and performance - Sockets now only copy the send and recv data once rather than multiple times
This commit is contained in:
@@ -554,6 +554,9 @@ pub enum NetworkError {
|
||||
/// A call to write returned 0
|
||||
#[error("write returned 0")]
|
||||
WriteZero,
|
||||
/// OS error
|
||||
#[error("operating system error({0})")]
|
||||
OsError(i32),
|
||||
/// The operation is not supported.
|
||||
#[error("unsupported")]
|
||||
Unsupported,
|
||||
@@ -563,6 +566,7 @@ pub enum NetworkError {
|
||||
}
|
||||
|
||||
pub fn net_error_into_io_err(net_error: NetworkError) -> std::io::Error {
|
||||
use std::io::Error;
|
||||
use std::io::ErrorKind;
|
||||
match net_error {
|
||||
NetworkError::InvalidFd => ErrorKind::BrokenPipe.into(),
|
||||
@@ -585,6 +589,7 @@ pub fn net_error_into_io_err(net_error: NetworkError) -> std::io::Error {
|
||||
NetworkError::UnexpectedEof => ErrorKind::UnexpectedEof.into(),
|
||||
NetworkError::WouldBlock => ErrorKind::WouldBlock.into(),
|
||||
NetworkError::WriteZero => ErrorKind::WriteZero.into(),
|
||||
NetworkError::OsError(code) => Error::from_raw_os_error(code),
|
||||
NetworkError::Unsupported => ErrorKind::Unsupported.into(),
|
||||
NetworkError::UnknownError => ErrorKind::BrokenPipe.into(),
|
||||
}
|
||||
@@ -610,6 +615,12 @@ pub fn io_err_into_net_error(net_error: std::io::Error) -> NetworkError {
|
||||
ErrorKind::WouldBlock => NetworkError::WouldBlock,
|
||||
ErrorKind::WriteZero => NetworkError::WriteZero,
|
||||
ErrorKind::Unsupported => NetworkError::Unsupported,
|
||||
_ => NetworkError::UnknownError,
|
||||
_ => {
|
||||
if let Some(code) = net_error.raw_os_error() {
|
||||
NetworkError::OsError(code)
|
||||
} else {
|
||||
NetworkError::UnknownError
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user