use crate::msgbuf::MsgBuf;
use crate::rpc::RpcInterior;
use crate::session::SessionRole;
use crate::transport::UdTransport;
use crate::type_alias::*;
pub(crate) struct SSlot {
pub req_idx: ReqIdx,
pub req_type: ReqType,
pub req: MsgBuf,
pub req_borrowed: bool,
pub pre_resp_msgbuf: MsgBuf,
pub resp: MsgBuf,
pub pkthdr: MsgBuf,
pub finished: bool,
pub has_handle: bool,
}
impl SSlot {
#[inline]
pub fn new(state: &mut RpcInterior, role: SessionRole, req_idx: ReqIdx) -> Self {
Self {
req_idx,
req_type: 0,
req: MsgBuf::dummy(),
req_borrowed: false,
pre_resp_msgbuf: match role {
SessionRole::Client => MsgBuf::dummy(),
SessionRole::Server => state.alloc_msgbuf(UdTransport::max_data_in_pkt()),
},
resp: MsgBuf::dummy(),
pkthdr: state.alloc_pkthdr_buf(),
finished: false,
has_handle: false,
}
}
#[inline(always)]
pub fn req_buf(&self) -> &MsgBuf {
&self.req
}
}