mirror of
https://github.com/arampoire/nut-rs.git
synced 2025-12-01 00:30:23 -05:00
Generify simple commands
This commit is contained in:
parent
c1d24a8278
commit
80928e69dd
3 changed files with 62 additions and 14 deletions
|
|
@ -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 {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue