[][src]Struct kcpserver::KcpPeer

pub struct KcpPeer<T: Send> {
    pub kcp: KcpLock,
    pub conv: u32,
    pub addr: SocketAddr,
    pub token: RefCell<TokenStore<T>>,
    pub last_rev_time: AtomicI64,
    pub next_update_time: AtomicU32,
    pub disconnect_event: RefCell<Option<Box<dyn FnOnce(u32)>>>,
    // some fields omitted
}

KCP Peer UDP的包进入 KCP PEER 经过KCP 处理后 输出 输入的包 进入KCP PEER处理,然后 输出到UDP PEER SEND TO 同时还需要一个UPDATE 线程 去10MS 一次的运行KCP UPDATE token 用于扩赞逻辑上下文

Fields

kcp: KcpLockconv: u32addr: SocketAddrtoken: RefCell<TokenStore<T>>last_rev_time: AtomicI64next_update_time: AtomicU32disconnect_event: RefCell<Option<Box<dyn FnOnce(u32)>>>

Implementations

impl<T: Send> KcpPeer<T>[src]

简化KCP PEER 函数

pub fn disconnect(&self)[src]

pub async fn send<'_, '_>(&'_ self, buf: &'_ [u8]) -> KcpResult<usize>[src]

pub async fn flush<'_>(&'_ self) -> KcpResult<()>[src]

pub async fn flush_async<'_>(&'_ self) -> KcpResult<()>[src]

pub fn get_main_tx(&self) -> Sender<RecvType>[src]

Trait Implementations

impl<T: Send> Drop for KcpPeer<T>[src]

impl<T: Send> Send for KcpPeer<T>[src]

impl<T: Send> Sync for KcpPeer<T>[src]

Auto Trait Implementations

impl<T> !RefUnwindSafe for KcpPeer<T>

impl<T> Unpin for KcpPeer<T> where
    T: Unpin

impl<T> !UnwindSafe for KcpPeer<T>

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.