[][src]Struct roa::tcp::TcpIncoming

#[must_use = "streams do nothing unless polled"]pub struct TcpIncoming { /* fields omitted */ }
This is supported on feature="tcp" only.

A stream of connections from binding to an address. As an implementation of roa_core::Accept.

Methods

impl TcpIncoming[src]

pub fn bind(addr: impl ToSocketAddrs) -> Result<Self>[src]

This is supported on feature="tcp" only.

Creates a new TcpIncoming binding to provided socket address.

pub fn from_std(listener: StdListener) -> Result<Self>[src]

This is supported on feature="tcp" only.

Creates a new TcpIncoming from std TcpListener.

pub fn local_addr(&self) -> SocketAddr[src]

This is supported on feature="tcp" only.

Get the local address bound to this listener.

pub fn set_nodelay(&mut self, enabled: bool) -> &mut Self[src]

This is supported on feature="tcp" only.

Set the value of TCP_NODELAY option for accepted connections.

pub fn set_sleep_on_errors(&mut self, val: bool)[src]

This is supported on feature="tcp" only.

Set whether to sleep on accept errors.

A possible scenario is that the process has hit the max open files allowed, and so trying to accept a new connection will fail with EMFILE. In some cases, it's preferable to just wait for some time, if the application will likely close some files (or connections), and try to accept the connection again. If this option is true, the error will be logged at the error level, since it is still a big deal, and then the listener will sleep for 1 second.

In other cases, hitting the max open files should be treat similarly to being out-of-memory, and simply error (and shutdown). Setting this option to false will allow that.

Default is true.

Trait Implementations

impl Accept for TcpIncoming[src]

type Conn = AddrStream<TcpStream>

The connection type that can be accepted.

type Error = Error

The error type that can occur when accepting a connection.

impl Debug for TcpIncoming[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> Same<T> for T

type Output = T

Should always be Self

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>,