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

SslStream does not implement clone #6

Closed
mathieulegrand opened this issue Mar 19, 2014 · 7 comments
Closed

SslStream does not implement clone #6

mathieulegrand opened this issue Mar 19, 2014 · 7 comments

Comments

@mathieulegrand
Copy link

openssl::ssl::SslStream<std::io::net::tcp::TcpStream> does not implement any method in scope named clone

TcpStream implements clone; my use case would be to clone to use the object in a spawned task:

let stream = stream.clone();
task::task().spawn(proc() {
    let mut stream = stream;
    []
});
@chris-morgan
Copy link
Contributor

This will probably be necessary for implementing high-performance HTTP/2.0.

@sfackler
Copy link
Owner

Doing this properly will be a bit tricky since OpenSSL doesn't expose the ability to bump an SSL struct's refcount manually. I guess I could wrap it in an Arc but that's a bit sad.

@seanmonstar
Copy link
Contributor

I also just ran into this. I clone the TcpStreams to make a Request and Response that a handler can deal with, and found I can't do so if I use SslStreams instead.

@reem
Copy link
Contributor

reem commented Sep 16, 2014

Ya, in Hyper we have to wrap the SslStream in Arc<Mutex>, which is far from ideal. We could bug the OpenSSL guys to add that API.

@retep998
Copy link
Contributor

An Arc<Mutex> wrapper means that writing and reading cannot be done in parallel. It would really have to be implemented at the level of this library in order to allow for parallel reading and writing.

@aatxe
Copy link
Contributor

aatxe commented Nov 29, 2014

👍 I need this enhancement for the reasons stated by @retep998.

@aatxe
Copy link
Contributor

aatxe commented Nov 29, 2014

Thanks! I'm excited for this change to be up on crates.io.

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

No branches or pull requests

7 participants