8000 client: make ClientSessionImpl Sync-compatible by Keruspe · Pull Request #97 · rustls/rustls · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

client: make ClientSessionImpl Sync-compatible #97

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

Merged
merged 1 commit into from
Oct 22, 2017
Merged

Conversation

Keruspe
Copy link
Contributor
@Keruspe Keruspe commented Aug 22, 2017

Otherwise rustls can be tough to use in some multi threaded environment.

Signed-off-by: Marc-Antoine Perennou <Marc-Antoine@Perennou.com>
@coveralls
Copy link

Coverage Status

Coverage remained the same at 94.334% when pulling d1647b6 on Keruspe:master into 54c02de on ctz:master.

@briansmith
Copy link
Contributor

What kind of threading model are you trying to support? IMO it makes more sense for the session state to be Send only, and then require the layer above that manages sessions to ensure that only one thread at a time accesses the session state. Actually, I think it might be better to do a bit more than that, but requiring all the client-side state to be Sync seems too much, without more explanation.

@Keruspe
Copy link
Contributor Author
Keruspe commented Aug 28, 2017

I am actually not that familiar with the Sync trait.

I am using tokio-rustls to get a tls stream used to create a client, then I may have several threads, the client creating one channel per thread (and using a Arc<Mutex<>> to guard the stream).

I managed to workaround that by using tokio-core's "handle.spawn" instead of creating an std::thread.

It looks like I wasn't the only one hit by that: stepancheg/rust-tls-api@b7b396f

Note that before 548db19 it worked fine

@ctz
Copy link
Member
ctz commented Oct 22, 2017

Yes, you're right that ClientSession/ServerSession should both be both Send and Sync. Sorry about that.

I earlier thought that std::marker::Sync meant something quite significantly more scary than it actually does.

79F5

@ctz ctz merged commit d1647b6 into rustls:master Oct 22, 2017
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.

4 participants
0