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

list_readers returning NoService error after restarting pcsc service #21

Closed
CountryTk opened this issue Nov 17, 2021 · 8 comments
Closed

Comments

@CountryTk
Copy link

CountryTk commented Nov 17, 2021

When starting my program with the pcsc service enabled, everything works fine but when I restart the pcsc service while my actix server is running and listening then list_readers returns a NoService error and never recovers from it (as in it never finds the service again)

What could be the cause of this? My actix server?

@bluetech
Copy link
Owner

Which operating system are you using?

@CountryTk
Copy link
Author

Currently using Linux (Ubuntu) and restarting the service with sudo systemctl restart pcsc.socket

@bluetech
Copy link
Owner

Is there a reason to restart the socket instead of sudo systemctl restart pcsc.service (the service)?

@CountryTk
Copy link
Author

Restarting the service or the socket both show the same behaviour, list_readers throws NoService after restart

@bluetech
Copy link
Owner

Hmm pcsclite client must not be able to handle this gracefully on its own then.

Are you able to check if context.is_valid() returns false in this state?

@CountryTk
Copy link
Author

context.is_valid() returns Ok(()) when I started my program with the service running and it also returns the same thing when I restart the service during program running.

@bluetech
Copy link
Owner

Too bad, I was hoping you could detect this.

Reading pcsclite's code, it unfortunately doesn't handle this - if the connection to the service is gone (returns EPIPE in this case) it doesn't try to reestablish it. So I think the only way to handle this is to reestablish the pcsc context upon receiving this error. If you can do this, it's probably best. If not, you might want to reach out to the pcsclite devs with your use case (mailing list, github).

@CountryTk
Copy link
Author

Thank you for this insight though, now I know what my next steps should be. I think I will close the issue since it's kind of out of scope for this crate. Thank you again though!

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