Skip to content

Commit 2ce4334

Browse files
committed
removed Session::id
1 parent 719afe6 commit 2ce4334

File tree

3 files changed

+3
-18
lines changed

3 files changed

+3
-18
lines changed

russh/src/lib.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -473,7 +473,7 @@ mod test_compress {
473473

474474
use async_trait::async_trait;
475475
use log::debug;
476-
476+
477477
use super::server::{Server as _, Session};
478478
use super::*;
479479
use crate::server::Msg;
@@ -826,7 +826,7 @@ mod test_channels {
826826
test_session(
827827
Client {},
828828
sh,
829-
|mut client| async move {
829+
|client| async move {
830830
let ch = client.channel_open_session().await.unwrap();
831831
let mut stream = ch.into_stream();
832832
stream.write_all(&b"request"[..]).await.unwrap();
@@ -918,7 +918,7 @@ mod test_channels {
918918
test_session(
919919
Client {},
920920
sh,
921-
|mut c| async move {
921+
|c| async move {
922922
let mut ch = c.channel_open_session().await.unwrap();
923923
ch.data(&b"hello world!"[..]).await.unwrap();
924924

russh/src/server/mod.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -803,7 +803,6 @@ where
803803
let common = read_ssh_id(config, &mut stream).await?;
804804
let handle = server::session::Handle { sender };
805805
let session = Session {
806-
session_id: get_session_id(),
807806
target_window_size: common.config.window_size,
808807
common,
809808
receiver,

russh/src/server/session.rs

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
use std::collections::HashMap;
2-
use std::sync::atomic::{AtomicUsize, Ordering};
32
use std::sync::Arc;
43

54
use russh_keys::encoding::Encoding;
@@ -11,15 +10,8 @@ use super::*;
1110
use crate::channels::{Channel, ChannelMsg};
1211
use crate::msg;
1312

14-
static SESSION_COUNTER: AtomicUsize = AtomicUsize::new(0);
15-
16-
pub(crate) fn get_session_id() -> usize {
17-
SESSION_COUNTER.fetch_add(1, Ordering::SeqCst)
18-
}
19-
2013
/// A connected server session. This type is unique to a client.
2114
pub struct Session {
22-
pub(crate) session_id: usize,
2315
pub(crate) common: CommonSession<Arc<Config>>,
2416
pub(crate) sender: Handle,
2517
pub(crate) receiver: Receiver<Msg>,
@@ -481,12 +473,6 @@ impl Session {
481473
Ok(())
482474
}
483475

484-
/// Application-unqiue session ID. Can be used for identifying the session
485-
/// across method calls.
486-
pub fn id(&self) -> usize {
487-
self.session_id
488-
}
489-
490476
/// Get a handle to this session.
491477
pub fn handle(&self) -> Handle {
492478
self.sender.clone()

0 commit comments

Comments
 (0)