Changeset - cef38284c738
[Not reviewed]
0 3 0
Christopher Esterhuyse - 5 years ago 2020-07-22 16:49:19
christopher.esterhuyse@gmail.com
merge
3 files changed with 2 insertions and 18 deletions:
0 comments (0 inline, 0 general)
Cargo.toml
Show inline comments
 
@@ -29,7 +29,7 @@ lazy_static = "1.4.0"
 

	
 
# socket ffi
 
libc = { version = "^0.2", optional = true }
 
os_socketaddr = { verion = "0.1.0", optional = true }
 
os_socketaddr = { version = "0.1.0", optional = true }
 

	
 
[dev-dependencies]
 
# test-generator = "0.3.0"
src/ffi/mod.rs
Show inline comments
 
@@ -75,21 +75,6 @@ impl StoredError {
 
thread_local! {
 
    static STORED_ERROR: RefCell<StoredError> = RefCell::new(StoredError::default());
 
}
 
unsafe fn tl_socketaddr_from_raw(
 
    bytes_ptr: *const u8,
 
    bytes_len: usize,
 
) -> Result<SocketAddr, c_int> {
 
    std::str::from_utf8(&*slice_from_raw_parts(bytes_ptr, bytes_len))
 
        .map_err(|err| {
 
            StoredError::tl_debug_store(&err);
 
            ERR_REOWOLF
 
        })?
 
        .parse()
 
        .map_err(|err| {
 
            StoredError::tl_debug_store(&err);
 
            ERR_REOWOLF
 
        })
 
}
 

	
 
pub const ERR_OK: c_int = 0;
 
pub const ERR_REOWOLF: c_int = -1;
src/ffi/pseudo_socket_api.rs
Show inline comments
 
@@ -16,7 +16,6 @@ struct FdAllocator {
 
}
 
struct ConnectorBound {
 
    connector: Connector,
 
    is_nonblocking: bool,
 
    putter: PortId,
 
    getter: PortId,
 
}
 
@@ -155,7 +154,7 @@ pub unsafe extern "C" fn rw_bind(fd: c_int, addr: *const sockaddr, addr_len: soc
 
            Connector::random_id(),
 
        );
 
        let [putter, getter] = connector.new_udp_mediator_component(addr, cc.peer_addr).unwrap();
 
        Some(ConnectorBound { connector, putter, getter, is_nonblocking: false })
 
        Some(ConnectorBound { connector, putter, getter })
 
    };
 
    ERR_OK
 
}
0 comments (0 inline, 0 general)