| 1319 | } |
| 1320 | #[pygetset(setter)] |
| 1321 | fn set_num_tickets(&self, value: isize, vm: &VirtualMachine) -> PyResult<()> { |
| 1322 | // Check for negative values |
| 1323 | if value < 0 { |
| 1324 | return Err(vm.new_value_error("num_tickets must be a non-negative integer")); |
| 1325 | } |
| 1326 | |
| 1327 | // Check that this is a server context |
| 1328 | if self.protocol != SslVersion::TlsServer { |
| 1329 | return Err(vm.new_value_error("SSLContext is not a server context.")); |
| 1330 | } |
| 1331 | |
| 1332 | #[cfg(ossl110)] |
| 1333 | { |
| 1334 | let ctx = self.builder(); |
| 1335 | let result = unsafe { sys::SSL_CTX_set_num_tickets(ctx.as_ptr(), value as usize) }; |
| 1336 | if result != 1 { |
| 1337 | return Err(vm.new_value_error("failed to set num tickets.")); |
| 1338 | } |
| 1339 | Ok(()) |
| 1340 | } |
| 1341 | #[cfg(not(ossl110))] |
| 1342 | { |
| 1343 | let _ = (value, vm); |
| 1344 | Ok(()) |
| 1345 | } |
| 1346 | } |
| 1347 | |
| 1348 | #[pymethod] |
| 1349 | fn set_default_verify_paths(&self, vm: &VirtualMachine) -> PyResult<()> { |