pub struct Session {
pub cluster_id: Option<String>,
pub listener_token: Token,
/* private fields */
}
Expand description
HTTP Session to insert in the SessionManager
1 session <=> 1 HTTP connection (client to sozu)
Fields§
§cluster_id: Option<String>
§listener_token: Token
Implementations§
source§impl Session
impl Session
pub fn new(
sock: TcpStream,
token: Token,
pool: Weak<RefCell<Pool>>,
proxy: Rc<RefCell<Proxy>>,
public_address: SocketAddr,
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>>
) -> Self
pub fn upgrade(&mut self) -> bool
pub fn set_answer(
&mut self,
answer: DefaultAnswerStatus,
buf: Option<Rc<Vec<u8>>>
)
pub fn http(&self) -> Option<&Http<TcpStream, Listener>>
pub fn http_mut(&mut self) -> Option<&mut Http<TcpStream, Listener>>
pub fn get_host(&self) -> Option<&str>
pub fn extract_route(&self) -> Result<(&str, &str, &Method)>
pub fn backend_from_request(
&mut self,
cluster_id: &str,
front_should_stick: bool
) -> Result<TcpStream>
Trait Implementations§
source§impl ProxyConfiguration<Session> for Proxy
impl ProxyConfiguration<Session> for Proxy
fn notify(&mut self, message: ProxyRequest) -> ProxyResponse
fn accept(&mut self, token: ListenToken) -> Result<TcpStream, AcceptError>
fn create_session(
&mut self,
frontend_sock: TcpStream,
listener_token: ListenToken,
wait_time: Duration,
proxy: Rc<RefCell<Self>>
) -> Result<(), AcceptError>
source§impl ProxySession for Session
impl ProxySession for Session
source§fn process_events(&mut self, token: Token, events: Ready)
fn process_events(&mut self, token: Token, events: Ready)
this seems to update session readiness but it does not process events
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 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)