pub trait UnixListenerExt {
    unsafe fn accept_overlapped(
        &self,
        socket: &UnixStream,
        addrs: &mut AcceptAddrsBuf,
        overlapped: *mut OVERLAPPED
    ) -> Result<bool>; fn accept_complete(&self, socket: &UnixStream) -> Result<()>; unsafe fn result(&self, overlapped: *mut OVERLAPPED) -> Result<(usize, u32)>; }
Expand description

Additional methods for the UnixListener type

Required Methods

Perform an accept operation on this listener, accepting a connection in an overlapped fashion.

This function will issue an I/O request to accept an incoming connection with the specified overlapped instance. The socket provided must be configured but not bound or connected. If successful this method will consume the socket to return a Unix stream.

The addrs buffer provided will be filled in with the local and remote addresses of the connection upon completion.

If the accept succeeds immediately, Ok(true) is returned. If the connect indicates that the I/O is currently pending, Ok(false) is returned. Otherwise, the error associated with the operation is returned and no overlapped operation is enqueued.

Unsafety

This function is unsafe because the kernel requires that the addrs and overlapped pointers are valid until the end of the I/O operation. The kernel also requires that overlapped is unique for this I/O operation and is not in use for any other I/O.

To safely use this function callers must ensure that the pointers are valid until the I/O operation is completed, typically via completion ports and waiting to receive the completion notification on the port.

Once an accept_overlapped has finished, this function needs to be called to finish the accept operation.

Currently this just calls setsockopt with SO_UPDATE_ACCEPT_CONTEXT to ensure that further functions like getpeername and getsockname work correctly.

Calls the GetOverlappedResult function to get the result of an overlapped operation for this handle.

This function takes the OVERLAPPED argument which must have been used to initiate an overlapped I/O operation, and returns either the successful number of bytes transferred during the operation or an error if one occurred, along with the results of the lpFlags parameter of the relevant operation, if applicable.

Unsafety

This function is unsafe as overlapped must have previously been used to execute an operation for this handle, and it must also be a valid pointer to an OVERLAPPED instance.

Panics

This function will panic

Implementors