Simplify Daemon::reconnect()

This commit is contained in:
Roman Zeyde 2018-07-28 11:57:20 +03:00
parent defe9f13af
commit 06f5a099a4
No known key found for this signature in database
GPG Key ID: 87CAE5FA46917CBB

View File

@ -155,15 +155,7 @@ impl Connection {
}
pub fn reconnect(&self) -> Result<Connection> {
let conn = tcp_connect(self.addr)?;
let reader = BufReader::new(conn.try_clone()
.chain_err(|| format!("failed to clone {:?}", conn))?);
Ok(Connection {
tx: conn,
rx: reader.lines(),
cookie_getter: self.cookie_getter.clone(),
addr: self.addr,
})
Connection::new(self.addr, self.cookie_getter.clone())
}
fn send(&mut self, request: &str) -> Result<()> {