Skip to content

Commit

Permalink
chore: bump to 0.6.1 (#371)
Browse files Browse the repository at this point in the history
  • Loading branch information
driftluo authored Jun 13, 2024
1 parent 86e442a commit 34ce87d
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 4 deletions.
2 changes: 1 addition & 1 deletion tentacle/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "tentacle"
version = "0.6.0"
version = "0.6.1"
license = "MIT"
description = "Minimal implementation for a multiplexed p2p network framework."
authors = ["piaoliu <[email protected]>", "Nervos Core Dev <[email protected]>"]
Expand Down
25 changes: 22 additions & 3 deletions tentacle/src/service/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,15 @@ use crate::{
yamux::config::Config as YamuxConfig,
ProtocolId, SessionId,
};
#[cfg(unix)]
use std::os::unix::io::{AsRawFd, FromRawFd, IntoRawFd, RawFd};
#[cfg(windows)]
use std::os::windows::io::{AsRawSocket, FromRawSocket, IntoRawSocket, RawSocket};
use std::os::windows::io::{
AsRawSocket, AsSocket, BorrowedSocket, FromRawSocket, IntoRawSocket, RawSocket,
};
#[cfg(unix)]
use std::os::{
fd::AsFd,
unix::io::{AsRawFd, BorrowedFd, FromRawFd, IntoRawFd, RawFd},
};
use std::{sync::Arc, time::Duration};
#[cfg(feature = "tls")]
use tokio_rustls::rustls::{ClientConfig, ServerConfig};
Expand Down Expand Up @@ -144,6 +149,13 @@ impl IntoRawFd for TcpSocket {
}
}

#[cfg(unix)]
impl AsFd for TcpSocket {
fn as_fd(&self) -> BorrowedFd<'_> {
self.inner.as_fd()
}
}

#[cfg(windows)]
impl IntoRawSocket for TcpSocket {
fn into_raw_socket(self) -> RawSocket {
Expand All @@ -167,6 +179,13 @@ impl FromRawSocket for TcpSocket {
}
}

#[cfg(windows)]
impl AsSocket for TcpSocket {
fn as_socket(&self) -> BorrowedSocket<'_> {
unsafe { BorrowedSocket::borrow_raw(self.as_raw_socket()) }
}
}

/// tls config wrap for server setup
#[derive(Clone, Default)]
#[cfg(feature = "tls")]
Expand Down

0 comments on commit 34ce87d

Please sign in to comment.