c4socket_fromNative

Function c4socket_fromNative 

Source
pub unsafe extern "C" fn c4socket_fromNative(
    factory: C4SocketFactory,
    nativeHandle: *mut c_void,
    address: *const C4Address,
) -> *mut C4Socket
Expand description

Constructs a C4Socket from a “native handle”, whose interpretation is up to the C4SocketFactory. This is used by listeners to handle an incoming replication connection. @warning You MUST immediately call c4socket_retain on this pointer (and the usual c4socket_release when done.) This is inconsistent with the general ref-counting convention, but fixing this function to return a retained value would cause all existing platforms to leak C4Sockets, so we’re leaving it alone. @param factory The C4SocketFactory that will manage the socket. @param nativeHandle A value known to the factory that represents the underlying socket, such as a file descriptor or a native object pointer. @param address The address of the remote peer making the connection. @return A new C4Socket initialized with the nativeHandle.