pub fn new_pair(
        kernel: &Kernel,
        domain: SocketDomain,
        socket_type: SocketType,
        credentials: ucred,
        open_flags: OpenFlags,
    ) -> (FileHandle, FileHandle) {
        let left = Socket::new(domain, socket_type);
        let right = Socket::new(domain, socket_type);
        left.lock().state = SocketState::Connected(right.clone());
        left.lock().credentials = Some(credentials.clone());
        right.lock().state = SocketState::Connected(left.clone());
        right.lock().credentials = Some(credentials);
        let left = Socket::new_file(kernel, left, open_flags);
        let right = Socket::new_file(kernel, right, open_flags);
        (left, right)
    }
/// Creates a pair of connected sockets.
///
/// # Parameters
/// - `domain`: The domain of the socket (e.g., `AF_UNIX`).
/// - `socket_type`: The type of the socket (e.g., `SOCK_STREAM`).
Creates a pair of connected sockets.
Creates a pair of connected sockets .
pub fn new_pair(
        kernel: &Kernel,
        domain: SocketDomain,
        socket_type: SocketType,
        credentials: ucred,
        open_flags: OpenFlags,
    ) -> (FileHandle, FileHandle) {
        let left = Socket::new(domain, socket_type);
        let right = Socket::new(domain, socket_type);
        left.lock().state = SocketState::Connected(right.clone());
        left.lock().credentials = Some(credentials.clone());
        right.lock().state = SocketState::Connected(left.clone());
        right.lock().credentials = Some(credentials);
        let left = Socket::new_file(kernel, left, open_flags);
        let right = Socket::new_file(kernel, right, open_flags);
        (left, right)
    }
pub fn new_pair ( kernel : & Kernel , domain : SocketDomain , socket_type : SocketType , credentials : ucred , open_flags : OpenFlags , ) -> ( FileHandle , FileHandle ) { let left = Socket :: new ( domain , socket_type ) ; let right = Socket :: new ( domain , socket_type ) ; left . lock ( ) . state = SocketState :: Connected ( right . clone ( ) ) ; left . lock ( ) . credentials = Some ( credentials . clone ( ) ) ; right . lock ( ) . state = SocketState :: Connected ( left . clone ( ) ) ; right . lock ( ) . credentials = Some ( credentials ) ; let left = Socket :: new_file ( kernel , left , open_flags ) ; let right = Socket :: new_file ( kernel , right , open_flags ) ; ( left , right ) }
Creates a pair of connected sockets.
Creates a pair of connected sockets .
kernel
&Kernel
domain
SocketDomain
socket_type
SocketType
credentials
ucred
open_flags
OpenFlags
kernel
&Kernel
domain
SocketDomain
The domain of the socket .
The domain of the socket .
socket_type
SocketType
The type of the socket .
The type of the socket .
credentials
ucred
open_flags
OpenFlags