MCPcopy Index your code
hub / github.com/RustPython/RustPython / session_stats

Method session_stats

crates/stdlib/src/openssl.rs:1637–1663  ·  view source on GitHub ↗
(&self, vm: &VirtualMachine)

Source from the content-addressed store, hash-verified

1635
1636 #[pymethod]
1637 fn session_stats(&self, vm: &VirtualMachine) -> PyResult {
1638 let ctx = self.ctx();
1639 let ctx_ptr = ctx.as_ptr();
1640
1641 let dict = vm.ctx.new_dict();
1642
1643 macro_rules! add_stat {
1644 ($key:expr, $func:ident) => {
1645 let value = unsafe { $func(ctx_ptr) };
1646 dict.set_item($key, vm.ctx.new_int(value).into(), vm)?;
1647 };
1648 }
1649
1650 add_stat!("number", SSL_CTX_sess_number);
1651 add_stat!("connect", SSL_CTX_sess_connect);
1652 add_stat!("connect_good", SSL_CTX_sess_connect_good);
1653 add_stat!("connect_renegotiate", SSL_CTX_sess_connect_renegotiate);
1654 add_stat!("accept", SSL_CTX_sess_accept);
1655 add_stat!("accept_good", SSL_CTX_sess_accept_good);
1656 add_stat!("accept_renegotiate", SSL_CTX_sess_accept_renegotiate);
1657 add_stat!("hits", SSL_CTX_sess_hits);
1658 add_stat!("misses", SSL_CTX_sess_misses);
1659 add_stat!("timeouts", SSL_CTX_sess_timeouts);
1660 add_stat!("cache_full", SSL_CTX_sess_cache_full);
1661
1662 Ok(dict.into())
1663 }
1664
1665 #[pymethod]
1666 fn load_dh_params(&self, filepath: FsPath, vm: &VirtualMachine) -> PyResult<()> {

Callers

nothing calls this directly

Calls 3

new_dictMethod · 0.80
ctxMethod · 0.45
as_ptrMethod · 0.45

Tested by

no test coverage detected