fix(client): handle when DNS resolves after a timeout triggers
Closes #848
This commit is contained in:
		| @@ -16,7 +16,7 @@ pub trait Connect { | ||||
|     /// Type of Transport to create | ||||
|     type Output: Transport; | ||||
|     /// The key used to determine if an existing socket can be used. | ||||
|     type Key: Eq + Hash + Clone; | ||||
|     type Key: Eq + Hash + Clone + fmt::Debug; | ||||
|     /// Returns the key based off the Url. | ||||
|     fn key(&self, &Url) -> Option<Self::Key>; | ||||
|     /// Connect to a remote address. | ||||
| @@ -96,10 +96,12 @@ impl Connect for HttpConnector { | ||||
|     } | ||||
|  | ||||
|     fn connected(&mut self) -> Option<(Self::Key, io::Result<HttpStream>)> { | ||||
|         let (host, addr) = match self.dns.as_ref().expect("dns workers lost").resolved() { | ||||
|         let (host, addrs) = match self.dns.as_ref().expect("dns workers lost").resolved() { | ||||
|             Ok(res) => res, | ||||
|             Err(_) => return None | ||||
|         }; | ||||
|         //TODO: try all addrs | ||||
|         let addr = addrs.and_then(|mut addrs| Ok(addrs.next().unwrap())); | ||||
|         debug!("Http::resolved <- ({:?}, {:?})", host, addr); | ||||
|         if let Entry::Occupied(mut entry) = self.resolving.entry(host) { | ||||
|             let resolved = entry.get_mut().remove(0); | ||||
|   | ||||
		Reference in New Issue
	
	Block a user