summaryrefslogtreecommitdiffstats
path: root/third_party/rust/mio/src/net/mod.rs
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 19:33:14 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 19:33:14 +0000
commit36d22d82aa202bb199967e9512281e9a53db42c9 (patch)
tree105e8c98ddea1c1e4784a60a5a6410fa416be2de /third_party/rust/mio/src/net/mod.rs
parentInitial commit. (diff)
downloadfirefox-esr-upstream.tar.xz
firefox-esr-upstream.zip
Adding upstream version 115.7.0esr.upstream/115.7.0esrupstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'third_party/rust/mio/src/net/mod.rs')
-rw-r--r--third_party/rust/mio/src/net/mod.rs37
1 files changed, 37 insertions, 0 deletions
diff --git a/third_party/rust/mio/src/net/mod.rs b/third_party/rust/mio/src/net/mod.rs
new file mode 100644
index 0000000000..c8cef17e98
--- /dev/null
+++ b/third_party/rust/mio/src/net/mod.rs
@@ -0,0 +1,37 @@
+//! Networking primitives.
+//!
+//! The types provided in this module are non-blocking by default and are
+//! designed to be portable across all supported Mio platforms. As long as the
+//! [portability guidelines] are followed, the behavior should be identical no
+//! matter the target platform.
+//!
+//! [portability guidelines]: ../struct.Poll.html#portability
+//!
+//! # Notes
+//!
+//! When using a datagram based socket, i.e. [`UdpSocket`] or [`UnixDatagram`],
+//! its only possible to receive a packet once. This means that if you provide a
+//! buffer that is too small you won't be able to receive the data anymore. How
+//! OSs deal with this situation is different for each OS:
+//! * Unixes, such as Linux, FreeBSD and macOS, will simply fill the buffer and
+//! return the amount of bytes written. This means that if the returned value
+//! is equal to the size of the buffer it may have only written a part of the
+//! packet (or the packet has the same size as the buffer).
+//! * Windows returns an `WSAEMSGSIZE` error.
+//!
+//! Mio does not change the value (either ok or error) returned by the OS, it's
+//! up to the user handle this. How to deal with these difference is still up
+//! for debate, specifically in
+//! <https://github.com/rust-lang/rust/issues/55794>. The best advice we can
+//! give is to always call receive with a large enough buffer.
+
+mod tcp;
+pub use self::tcp::{TcpListener, TcpStream};
+
+mod udp;
+pub use self::udp::UdpSocket;
+
+#[cfg(unix)]
+mod uds;
+#[cfg(unix)]
+pub use self::uds::{SocketAddr, UnixDatagram, UnixListener, UnixStream};