pub struct SocketHandle<S: Socket>(/* private fields */);
Expand description
Tcp连接句柄
Implementations§
Source§impl<S: Socket> SocketHandle<S>
impl<S: Socket> SocketHandle<S>
Sourcepub fn new(image: SocketImage<S>) -> Self
pub fn new(image: SocketImage<S>) -> Self
构建Tcp连接句柄
Sourcepub fn get_local(&self) -> &SocketAddr
pub fn get_local(&self) -> &SocketAddr
线程安全的获取连接本地地址
Sourcepub fn get_remote(&self) -> &SocketAddr
pub fn get_remote(&self) -> &SocketAddr
线程安全的获取连接远端地址
Sourcepub fn set_timeout(&self, timeout: usize, event: SocketEvent)
pub fn set_timeout(&self, timeout: usize, event: SocketEvent)
线程安全的设置超时定时器
Sourcepub fn unset_timeout(&self)
pub fn unset_timeout(&self)
线程安全的取消超时定时器
Sourcepub fn is_security(&self) -> bool
pub fn is_security(&self) -> bool
线程安全的判断是否是安全连接
Sourcepub fn get_context(&self) -> Rc<UnsafeCell<SocketContext>>
pub fn get_context(&self) -> Rc<UnsafeCell<SocketContext>>
线程安全的获取Tcp连接上下文的只读引用
Sourcepub fn read_ready(&self, size: usize) -> GenResult<AsyncValue<usize>, usize>
pub fn read_ready(&self, size: usize) -> GenResult<AsyncValue<usize>, usize>
线程安全的准备读
Sourcepub fn get_read_buffer(&self) -> Rc<UnsafeCell<Option<BytesMut>>>
pub fn get_read_buffer(&self) -> Rc<UnsafeCell<Option<BytesMut>>>
线程安全的获取连接的接收缓冲区的引用
Sourcepub fn reregister_interest(&self, ready: Ready) -> Result<()>
pub fn reregister_interest(&self, ready: Ready) -> Result<()>
重新注册当前流感兴趣的事件
Sourcepub fn run_hibernated_tasks(&self)
pub fn run_hibernated_tasks(&self)
线程安全的开始执行连接休眠时加入的任务,当前任务执行完成后自动执行下一个任务,直到任务队列为空
Sourcepub fn hibernate(
&self,
handle: SocketHandle<S>,
ready: Ready,
) -> Option<Hibernate<S>>
pub fn hibernate( &self, handle: SocketHandle<S>, ready: Ready, ) -> Option<Hibernate<S>>
线程安全的异步休眠当前连接,直到被唤醒
Sourcepub fn set_hibernate(&self, hibernate: Hibernate<S>) -> bool
pub fn set_hibernate(&self, hibernate: Hibernate<S>) -> bool
线程安全的设置当前连接的休眠对象
Trait Implementations§
Source§impl<S: Socket> Clone for SocketHandle<S>
impl<S: Socket> Clone for SocketHandle<S>
Source§impl<S: Socket> Drop for SocketHandle<S>
impl<S: Socket> Drop for SocketHandle<S>
impl<S: Socket> Send for SocketHandle<S>
impl<S: Socket> Sync for SocketHandle<S>
Auto Trait Implementations§
impl<S> Freeze for SocketHandle<S>
impl<S> !RefUnwindSafe for SocketHandle<S>
impl<S> Unpin for SocketHandle<S>
impl<S> !UnwindSafe for SocketHandle<S>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more