mirror of
https://github.com/rustfs/rustfs.git
synced 2026-08-13 08:36:54 +00:00
Fix/fix improve for audit (#1418)
This commit is contained in:
@@ -378,20 +378,11 @@ pub async fn start_http_server(
|
||||
|
||||
// Enable TCP Keepalive to detect dead clients (e.g. power loss)
|
||||
// Idle: 10s, Interval: 5s, Retries: 3
|
||||
let ka = {
|
||||
#[cfg(not(target_os = "openbsd"))]
|
||||
let ka = TcpKeepalive::new()
|
||||
.with_time(Duration::from_secs(10))
|
||||
.with_interval(Duration::from_secs(5))
|
||||
.with_retries(3);
|
||||
|
||||
// On OpenBSD socket2 only supports configuring the initial
|
||||
// TCP keepalive timeout; intervals and retries cannot be set.
|
||||
#[cfg(target_os = "openbsd")]
|
||||
let ka = TcpKeepalive::new().with_time(Duration::from_secs(10));
|
||||
|
||||
ka
|
||||
};
|
||||
let mut ka = TcpKeepalive::new().with_time(Duration::from_secs(10));
|
||||
#[cfg(not(target_os = "openbsd"))]
|
||||
{
|
||||
ka = ka.with_interval(Duration::from_secs(5)).with_retries(3);
|
||||
}
|
||||
|
||||
if let Err(err) = socket_ref.set_tcp_keepalive(&ka) {
|
||||
warn!(?err, "Failed to set TCP_KEEPALIVE");
|
||||
|
||||
@@ -162,9 +162,17 @@ impl OperationHelper {
|
||||
.build();
|
||||
|
||||
let mut final_builder = builder.api(api_details.clone());
|
||||
if let Ok(res) = result {
|
||||
final_builder = final_builder.resp_header(extract_resp_elements(res));
|
||||
}
|
||||
if let Some(err) = error_msg {
|
||||
final_builder = final_builder.error(err);
|
||||
}
|
||||
|
||||
if let Some(sk) = rustfs_credentials::get_global_access_key_opt() {
|
||||
final_builder = final_builder.access_key(&sk);
|
||||
}
|
||||
|
||||
self.audit_builder = Some(final_builder);
|
||||
self.api_builder = ApiDetailsBuilder(api_details); // Store final details for Drop use
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user