[Changed] proto {Server,Client}::new use Arc
This commit is contained in:
parent
1921f2bf49
commit
0db05aa9bf
@ -1,6 +1,6 @@
|
||||
[package]
|
||||
name = "tokio-rustls"
|
||||
version = "0.1.2"
|
||||
version = "0.1.3"
|
||||
authors = ["quininer kel <quininer@live.com>"]
|
||||
license = "MIT/Apache-2.0"
|
||||
repository = "https://github.com/quininer/tokio-rustls"
|
||||
|
@ -94,7 +94,7 @@ impl<S, C> Future for MidHandshake<S, C>
|
||||
|
||||
fn poll(&mut self) -> Poll<Self::Item, Self::Error> {
|
||||
loop {
|
||||
let stream = self.inner.as_mut().unwrap_or_else(|| unreachable!());
|
||||
let stream = self.inner.as_mut().unwrap();
|
||||
if !stream.session.is_handshaking() { break };
|
||||
|
||||
match stream.do_io() {
|
||||
@ -111,7 +111,7 @@ impl<S, C> Future for MidHandshake<S, C>
|
||||
}
|
||||
}
|
||||
|
||||
Ok(Async::Ready(self.inner.take().unwrap_or_else(|| unreachable!())))
|
||||
Ok(Async::Ready(self.inner.take().unwrap()))
|
||||
}
|
||||
}
|
||||
|
||||
@ -228,4 +228,6 @@ impl<S, C> io::Write for TlsStream<S, C>
|
||||
}
|
||||
}
|
||||
|
||||
impl<S, C> Io for TlsStream<S, C> where S: Io, C: Session {}
|
||||
impl<S, C> Io for TlsStream<S, C> where S: Io, C: Session {
|
||||
// TODO impl poll_{read, write}
|
||||
}
|
||||
|
@ -41,10 +41,10 @@ impl<T> Server<T> {
|
||||
/// connections will go through the TLS acceptor first and then further I/O
|
||||
/// will go through the negotiated TLS stream through the `protocol`
|
||||
/// specified.
|
||||
pub fn new(protocol: T, acceptor: ServerConfig) -> Server<T> {
|
||||
pub fn new(protocol: T, acceptor: Arc<ServerConfig>) -> Server<T> {
|
||||
Server {
|
||||
inner: Arc::new(protocol),
|
||||
acceptor: Arc::new(acceptor),
|
||||
acceptor: acceptor,
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -302,11 +302,11 @@ impl<T> Client<T> {
|
||||
/// The `connector` provided will be used to configure the TLS connection. Further I/O
|
||||
/// will go through the negotiated TLS stream through the `protocol` specified.
|
||||
pub fn new(protocol: T,
|
||||
connector: ClientConfig,
|
||||
connector: Arc<ClientConfig>,
|
||||
hostname: &str) -> Client<T> {
|
||||
Client {
|
||||
inner: Arc::new(protocol),
|
||||
connector: Arc::new(connector),
|
||||
connector: connector,
|
||||
hostname: hostname.to_string(),
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user