pub struct Session {
pub frontend_token: Token,
pub backend: Option<Rc<RefCell<Backend>>>,
pub back_connected: BackendConnectionStatus,
pub public_address: StdSocketAddr,
pub metrics: SessionMetrics,
pub cluster_id: Option<String>,
pub listener_token: Token,
pub connection_attempt: u8,
pub listener: Rc<RefCell<Listener>>,
/* private fields */
}
Fields§
§frontend_token: Token
§backend: Option<Rc<RefCell<Backend>>>
§back_connected: BackendConnectionStatus
§public_address: StdSocketAddr
§metrics: SessionMetrics
§cluster_id: Option<String>
§listener_token: Token
§connection_attempt: u8
§listener: Rc<RefCell<Listener>>
Implementations§
source§impl Session
impl Session
pub fn new(
rustls_details: ServerConnection,
sock: MioTcpStream,
token: Token,
pool: Weak<RefCell<Pool>>,
proxy: Rc<RefCell<Proxy>>,
public_address: StdSocketAddr,
expect_proxy: bool,
sticky_name: String,
answers: Rc<RefCell<HttpAnswers>>,
listener_token: Token,
wait_time: Duration,
frontend_timeout_duration: Duration,
backend_timeout_duration: Duration,
request_timeout_duration: Duration,
listener: Rc<RefCell<Listener>>
) -> Session
pub fn set_answer(
&mut self,
answer: DefaultAnswerStatus,
buf: Option<Rc<Vec<u8>>>
)
pub fn upgrade(&mut self) -> bool
pub fn extract_route(&self) -> Result<(&str, &str, &Method)>
pub fn backend_from_request(
&mut self,
cluster_id: &str,
front_should_stick: bool
) -> Result<MioTcpStream>
Trait Implementations§
source§impl ProxyConfiguration<Session> for Proxy
impl ProxyConfiguration<Session> for Proxy
fn accept(&mut self, token: ListenToken) -> Result<MioTcpStream, AcceptError>
fn create_session(
&mut self,
frontend_sock: MioTcpStream,
token: ListenToken,
wait_time: Duration,
proxy: Rc<RefCell<Self>>
) -> Result<(), AcceptError>
fn notify(&mut self, message: ProxyRequest) -> ProxyResponse
source§impl ProxySession for Session
impl ProxySession for Session
source§fn timeout(&mut self, token: Token)
fn timeout(&mut self, token: Token)
if a timeout associated with the session triggers, the event loop will
call this method with the timeout’s token Read more
source§fn process_events(&mut self, token: Token, events: Ready)
fn process_events(&mut self, token: Token, events: Ready)
if the event loop got an event for a token associated with the session,
it will call this method on the session Read more
source§fn ready(&mut self, session: Rc<RefCell<dyn ProxySession>>)
fn ready(&mut self, session: Rc<RefCell<dyn ProxySession>>)
if a session received an event or can still execute, the event loop will
call this method. Its result indicates if it can still execute, needs to
connect to a backend server, close the session Read more
source§fn shutting_down(&mut self)
fn shutting_down(&mut self)
tells the session to shut down if possible Read more
source§fn last_event(&self) -> Instant
fn last_event(&self) -> Instant
last time the session got an event
source§fn print_state(&self)
fn print_state(&self)
displays the session’s internal state (for debugging purpose)