Generify simple commands

This commit is contained in:
Aram 🍐 2021-07-31 22:25:02 -04:00
parent c1d24a8278
commit 80928e69dd
3 changed files with 62 additions and 14 deletions

View file

@ -94,7 +94,8 @@ impl TcpConnection {
self.stream = self.stream.upgrade_ssl(sess)?;
// Send a test command
self.get_network_version()?;
self.write_cmd(Command::NetworkVersion)?;
self.read_plain_response()?;
}
Ok(self)
}
@ -119,12 +120,6 @@ impl TcpConnection {
Ok(())
}
#[allow(dead_code)]
fn get_network_version(&mut self) -> crate::Result<String> {
self.write_cmd(Command::NetworkVersion)?;
self.read_plain_response()
}
pub(crate) fn write_cmd(&mut self, line: Command) -> crate::Result<()> {
let line = format!("{}\n", line);
if self.config.debug {