Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handle concurrent clients implicitly within the SFTP server EventListener #452

Open
code-blooded245 opened this issue Jan 8, 2024 · 1 comment

Comments

@code-blooded245
Copy link

Description

I need to handle multiple users and multiple commands from each user.
For example multiple clients are executing put command to the SFTP server, in this case, I want to read the data in the SFTPEventListener class and do some processing.
But I saw that the class instance is shared amongst multiple users and multiple user sessions, due to which I am not able maintain any state inside the SFTPEventListener. Although I can write my own implementation to handle this scenario but it would have been better if there was an implicit handle given in the library.

Motivation

By adding this, concurrent user requests can be implicitly handled in the library.

Alternatives considered

No response

Additional context

No response

@tomaswolf
Copy link
Member

All the methods in SftpEventListener take the ServerSession as an argument. It should thus be possible to maintain per-session state in the listener. Either maintain a map per session (and register a listener on the session to remove items from the map when a session closes), or add whatever per-session data you want to maintain as an attribute on the session object. Wouldn't that work for your use case?

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

No branches or pull requests

2 participants