Skip to content

Commit 6606e28

Browse files
committed
fixed #141 - renamed Config::connection_timeout to Config::inactivity_timeout
1 parent af06252 commit 6606e28

File tree

7 files changed

+13
-13
lines changed

7 files changed

+13
-13
lines changed

russh/examples/echoserver.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ async fn main() {
1414
.init();
1515

1616
let config = russh::server::Config {
17-
connection_timeout: Some(std::time::Duration::from_secs(3600)),
17+
inactivity_timeout: Some(std::time::Duration::from_secs(3600)),
1818
auth_rejection_time: std::time::Duration::from_secs(3),
1919
auth_rejection_time_initial: Some(std::time::Duration::from_secs(0)),
2020
keys: vec![russh_keys::key::KeyPair::generate_ed25519().unwrap()],

russh/examples/remote_shell_call.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ impl Session {
6262
) -> Result<Self> {
6363
let key_pair = load_secret_key(key_path, None)?;
6464
let config = client::Config {
65-
connection_timeout: Some(Duration::from_secs(5)),
65+
inactivity_timeout: Some(Duration::from_secs(5)),
6666
..<_>::default()
6767
};
6868
let config = Arc::new(config);

russh/examples/sftp_server.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,7 @@ async fn main() {
185185
auth_rejection_time: Duration::from_secs(3),
186186
auth_rejection_time_initial: Some(Duration::from_secs(0)),
187187
keys: vec![KeyPair::generate_ed25519().unwrap()],
188-
connection_timeout: Some(Duration::from_secs(3600)),
188+
inactivity_timeout: Some(Duration::from_secs(3600)),
189189
..Default::default()
190190
};
191191

russh/src/client/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1240,7 +1240,7 @@ pub struct Config {
12401240
/// Lists of preferred algorithms.
12411241
pub preferred: negotiation::Preferred,
12421242
/// Time after which the connection is garbage-collected.
1243-
pub connection_timeout: Option<std::time::Duration>,
1243+
pub inactivity_timeout: Option<std::time::Duration>,
12441244
/// Whether to expect and wait for an authentication call.
12451245
pub anonymous: bool,
12461246
}
@@ -1257,7 +1257,7 @@ impl Default for Config {
12571257
window_size: 2097152,
12581258
maximum_packet_size: 32768,
12591259
preferred: Default::default(),
1260-
connection_timeout: None,
1260+
inactivity_timeout: None,
12611261
anonymous: false,
12621262
}
12631263
}

russh/src/lib.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -485,7 +485,7 @@ mod test_compress {
485485
let client_key = russh_keys::key::KeyPair::generate_ed25519().unwrap();
486486
let mut config = server::Config::default();
487487
config.preferred = Preferred::COMPRESSED;
488-
config.connection_timeout = None; // Some(std::time::Duration::from_secs(3));
488+
config.inactivity_timeout = None; // Some(std::time::Duration::from_secs(3));
489489
config.auth_rejection_time = std::time::Duration::from_secs(3);
490490
config
491491
.keys
@@ -623,7 +623,7 @@ async fn test_session<RC, RS, CH, SH, F1, F2>(
623623

624624
let client_key = russh_keys::key::KeyPair::generate_ed25519().unwrap();
625625
let mut config = server::Config::default();
626-
config.connection_timeout = None;
626+
config.inactivity_timeout = None;
627627
config.auth_rejection_time = std::time::Duration::from_secs(3);
628628
config
629629
.keys
@@ -637,7 +637,7 @@ async fn test_session<RC, RS, CH, SH, F1, F2>(
637637

638638
let server_join = tokio::spawn(async move {
639639
let (socket, _) = socket.accept().await.unwrap();
640-
640+
641641
server::run_stream(config, socket, server_handler)
642642
.await
643643
.map_err(|_| ())

russh/src/server/mod.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@
3939
//! let client_key = russh_keys::key::KeyPair::generate_ed25519().unwrap();
4040
//! let client_pubkey = Arc::new(client_key.clone_public_key().unwrap());
4141
//! let mut config = russh::server::Config::default();
42-
//! config.connection_timeout = Some(std::time::Duration::from_secs(3));
42+
//! config.inactivity_timeout = Some(std::time::Duration::from_secs(3));
4343
//! config.auth_rejection_time = std::time::Duration::from_secs(3);
4444
//! config.keys.push(russh_keys::key::KeyPair::generate_ed25519().unwrap());
4545
//! let config = Arc::new(config);
@@ -167,7 +167,7 @@ pub struct Config {
167167
/// Maximal number of allowed authentication attempts.
168168
pub max_auth_attempts: usize,
169169
/// Time after which the connection is garbage-collected.
170-
pub connection_timeout: Option<std::time::Duration>,
170+
pub inactivity_timeout: Option<std::time::Duration>,
171171
}
172172

173173
impl Default for Config {
@@ -189,7 +189,7 @@ impl Default for Config {
189189
limits: Limits::default(),
190190
preferred: Default::default(),
191191
max_auth_attempts: 10,
192-
connection_timeout: Some(std::time::Duration::from_secs(600)),
192+
inactivity_timeout: Some(std::time::Duration::from_secs(600)),
193193
}
194194
}
195195
}
@@ -724,7 +724,7 @@ async fn read_ssh_id<R: AsyncRead + Unpin>(
724724
config: Arc<Config>,
725725
read: &mut SshRead<R>,
726726
) -> Result<CommonSession<Arc<Config>>, Error> {
727-
let sshid = if let Some(t) = config.connection_timeout {
727+
let sshid = if let Some(t) = config.inactivity_timeout {
728728
tokio::time::timeout(t, read.read_ssh_id()).await??
729729
} else {
730730
read.read_ssh_id().await?

russh/src/server/session.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -333,7 +333,7 @@ impl Session {
333333
pin!(reading);
334334
let mut is_reading = None;
335335
let mut decomp = CryptoVec::new();
336-
let delay = self.common.config.connection_timeout;
336+
let delay = self.common.config.inactivity_timeout;
337337

338338
#[allow(clippy::panic)] // false positive in macro
339339
while !self.common.disconnected {

0 commit comments

Comments
 (0)