and constant to tools module.
Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
use proxmox::try_block;
use proxmox::api::RpcEnvironmentType;
+use proxmox::sys::linux::socket::set_tcp_keepalive;
use proxmox_backup::{
backup::DataStore,
use proxmox_backup::server;
use proxmox_backup::auth_helpers::*;
use proxmox_backup::tools::{
+ PROXMOX_BACKUP_TCP_KEEPALIVE_TIME,
daemon,
disks::{
DiskManage,
get_pool_from_dataset,
},
logrotate::LogRotate,
- socket::{
- set_tcp_keepalive,
- PROXMOX_BACKUP_TCP_KEEPALIVE_TIME,
- },
};
use proxmox_backup::api2::pull::do_sync_job;
pub mod nom;
pub mod runtime;
pub mod serde_filter;
-pub mod socket;
pub mod statistics;
pub mod subscription;
pub mod systemd;
}
}
+/// The default 2 hours are far too long for PBS
+pub const PROXMOX_BACKUP_TCP_KEEPALIVE_TIME: u32 = 120;
+
/// This used to be: `SIMPLE_ENCODE_SET` plus space, `"`, `#`, `<`, `>`, backtick, `?`, `{`, `}`
pub const DEFAULT_ENCODE_SET: &AsciiSet = &percent_encoding::CONTROLS // 0..1f and 7e
// The SIMPLE_ENCODE_SET adds space and anything >= 0x7e (7e itself is already included above)
};
use tokio_openssl::SslStream;
+use proxmox::sys::linux::socket::set_tcp_keepalive;
+
use crate::tools::{
+ PROXMOX_BACKUP_TCP_KEEPALIVE_TIME,
async_io::MaybeTlsStream,
- socket::{
- set_tcp_keepalive,
- PROXMOX_BACKUP_TCP_KEEPALIVE_TIME,
- },
};
// Build a http::uri::Authority ("host:port"), use '[..]' around IPv6 addresses
+++ /dev/null
-use std::os::unix::io::RawFd;
-
-use nix::sys::socket::sockopt::{KeepAlive, TcpKeepIdle};
-use nix::sys::socket::setsockopt;
-
-pub const PROXMOX_BACKUP_TCP_KEEPALIVE_TIME: u32 = 120;
-
-/// Set TCP keepalive time on a socket
-///
-/// See "man 7 tcp" for details.
-///
-/// The default on Linux is 7200 (2 hours) which is far too long for
-/// our backup tools.
-pub fn set_tcp_keepalive(
- socket_fd: RawFd,
- tcp_keepalive_time: u32,
-) -> nix::Result<()> {
-
- setsockopt(socket_fd, KeepAlive, &true)?;
- setsockopt(socket_fd, TcpKeepIdle, &tcp_keepalive_time)?;
-
- Ok(())
-}