mirror of https://github.com/fafhrd91/actix-net
				
				
				
			tweaks
This commit is contained in:
		
							parent
							
								
									d8134b648c
								
							
						
					
					
						commit
						b26115d7c5
					
				| 
						 | 
				
			
			@ -3,10 +3,10 @@
 | 
			
		|||
## Unreleased - 2021-xx-xx
 | 
			
		||||
### Added
 | 
			
		||||
* Derive `Debug` for `connect::Connection`. [#422]
 | 
			
		||||
* Implement `Display` for `accept::TlsError`. [#422]
 | 
			
		||||
* Implement `Error` for `accept::TlsError` where both types also implement `Error`. [#422]
 | 
			
		||||
* Implement `Default` for `connect::Resolver`. [#422]
 | 
			
		||||
* Implement `Display` for `TlsError`. [#422]
 | 
			
		||||
* Implement `Error` for `ConnectError`. [#422]
 | 
			
		||||
* Implement `Error` for `TlsError` where both types also implement `Error`. [#422]
 | 
			
		||||
* Implement `Error` for `connect::ConnectError`. [#422]
 | 
			
		||||
 | 
			
		||||
### Changed
 | 
			
		||||
* There are now no default features. [#422]
 | 
			
		||||
| 
						 | 
				
			
			@ -20,6 +20,7 @@
 | 
			
		|||
* Rename struct `connect::{ConnectService => ConnectorService}`. [#422]
 | 
			
		||||
* Rename struct `connect::{ConnectServiceFactory => Connector}`. [#422]
 | 
			
		||||
* Rename TLS acceptor service future types and hide from docs. [#422]
 | 
			
		||||
* Unbox some service futures types. [#422]
 | 
			
		||||
 | 
			
		||||
### Removed
 | 
			
		||||
* Remove `connect::{new_connector, new_connector_factory, default_connector, default_connector_factory}` methods. [#422]
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -4,10 +4,11 @@ use std::{
 | 
			
		|||
    net::SocketAddr,
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
#[derive(Debug, Eq, PartialEq, Hash)]
 | 
			
		||||
#[derive(Debug, Clone, Eq, PartialEq, Hash)]
 | 
			
		||||
pub(crate) enum ConnectAddrs {
 | 
			
		||||
    None,
 | 
			
		||||
    One(SocketAddr),
 | 
			
		||||
    // TODO: consider using smallvec
 | 
			
		||||
    Multi(VecDeque<SocketAddr>),
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -13,14 +13,14 @@ pub struct Connection<R, IO> {
 | 
			
		|||
}
 | 
			
		||||
 | 
			
		||||
impl<R, IO> Connection<R, IO> {
 | 
			
		||||
    /// Construct new `Connection` from
 | 
			
		||||
    pub(crate) fn new(io: IO, req: R) -> Self {
 | 
			
		||||
        Self { io, req }
 | 
			
		||||
    /// Construct new `Connection` from request and IO parts.
 | 
			
		||||
    pub(crate) fn new(req: R, io: IO) -> Self {
 | 
			
		||||
        Self { req, io }
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
impl<R, IO> Connection<R, IO> {
 | 
			
		||||
    /// Deconstructs into parts.
 | 
			
		||||
    /// Deconstructs into IO and request parts.
 | 
			
		||||
    pub fn into_parts(self) -> (IO, R) {
 | 
			
		||||
        (self.io, self.req)
 | 
			
		||||
    }
 | 
			
		||||
| 
						 | 
				
			
			@ -47,7 +47,7 @@ impl<R, IO> Connection<R, IO> {
 | 
			
		|||
}
 | 
			
		||||
 | 
			
		||||
impl<R: Host, IO> Connection<R, IO> {
 | 
			
		||||
    /// Get hostname.
 | 
			
		||||
    /// Returns hostname.
 | 
			
		||||
    pub fn hostname(&self) -> &str {
 | 
			
		||||
        self.req.hostname()
 | 
			
		||||
    }
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -148,12 +148,14 @@ impl<R: Host> Future for TcpConnectorFut<R> {
 | 
			
		|||
                match ready!(stream.poll(cx)) {
 | 
			
		||||
                    Ok(sock) => {
 | 
			
		||||
                        let req = req.take().unwrap();
 | 
			
		||||
 | 
			
		||||
                        trace!(
 | 
			
		||||
                            "TCP connector: successfully connected to {:?} - {:?}",
 | 
			
		||||
                            req.hostname(),
 | 
			
		||||
                            sock.peer_addr()
 | 
			
		||||
                        );
 | 
			
		||||
                        return Poll::Ready(Ok(Connection::new(sock, req)));
 | 
			
		||||
 | 
			
		||||
                        return Poll::Ready(Ok(Connection::new(req, sock)));
 | 
			
		||||
                    }
 | 
			
		||||
 | 
			
		||||
                    Err(err) => {
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue