feat(client): impl Sync for Client
Connector::connect already used &self, and so would require synchronization to be handled per connector anyway. Adding Sync to the Client allows users to setup config for a Client once, such as using a single connection Pool, and then making requests across multiple threads. Closes #254 BREAKING CHANGE: Connectors and Protocols passed to the `Client` must now also have a `Sync` bounds, but this shouldn't break default usage.
This commit is contained in:
@@ -317,7 +317,7 @@ impl NetworkStream for HttpStream {
|
||||
pub struct HttpConnector(pub Option<ContextVerifier>);
|
||||
|
||||
/// A method that can set verification methods on an SSL context
|
||||
pub type ContextVerifier = Box<Fn(&mut SslContext) -> () + Send>;
|
||||
pub type ContextVerifier = Box<Fn(&mut SslContext) -> () + Send + Sync>;
|
||||
|
||||
impl NetworkConnector for HttpConnector {
|
||||
type Stream = HttpStream;
|
||||
|
||||
Reference in New Issue
Block a user