Skip to content

server: Fix session not closing when a client disconnects#222

Closed
warusadura wants to merge 1 commit into
linux-credentials:mainfrom
warusadura:close_session
Closed

server: Fix session not closing when a client disconnects#222
warusadura wants to merge 1 commit into
linux-credentials:mainfrom
warusadura:close_session

Conversation

@warusadura
Copy link
Copy Markdown
Collaborator

@warusadura warusadura commented Mar 23, 2025

Fixes: #218

Comment thread server/src/service.rs Outdated
@warusadura warusadura marked this pull request as ready for review March 31, 2025 13:50
@warusadura warusadura changed the title wip: server: Fix sessions not closing server: Fix session not closing when client disconnects Mar 31, 2025
@warusadura warusadura changed the title server: Fix session not closing when client disconnects server: Fix session not closing when a client disconnects Mar 31, 2025
Comment thread server/src/service.rs Outdated
Comment thread server/src/service.rs Outdated
Comment thread server/src/service.rs
Comment thread server/src/service.rs
Comment thread server/src/service.rs Outdated
Comment thread server/src/service.rs Outdated
old_owner,
session_path
),
Err(_) => tracing::info!("Failed to close session: {}.", session_path),
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should not be just info!

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

May be error! ?

Comment thread server/src/service.rs Outdated
Comment thread server/src/service.rs Outdated
Comment thread server/Cargo.toml
@warusadura
Copy link
Copy Markdown
Collaborator Author

Sorry for the late response, will address review comments this week :)

Fixes: linux-credentials#218

Signed-off-by: Dhanuka Warusadura <dhanuka@gnome.org>
Comment thread server/src/session.rs
#[derive(Debug, Clone)]
pub struct Session {
aes_key: Option<Arc<Key>>,
client_name: String,
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why you are still converting this to a string? should also be just sender imho

Comment thread server/src/service.rs
Comment on lines +494 to +499
let Ok((_name, old_owner, new_owner)) =
message.body().deserialize::<(String, String, String)>()
else {
continue;
};

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can this ever fail to deserialize? also add the assertion that new_owner is empty, because you have it in the match rule...

Comment thread server/src/service.rs
old_owner,
session.path()
),
Err(_) => tracing::error!("Failed to close session."),
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Log the error please.

@bilelmoussaoui
Copy link
Copy Markdown
Collaborator

Merged to main after applying my suggested changes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

server: Sessions don't get closed when clients leave

2 participants