refactor
This commit is contained in:
parent
59b836b501
commit
1258b7e38f
2 changed files with 2 additions and 9 deletions
|
|
@ -75,9 +75,7 @@ impl EncryptedStream {
|
|||
pub fn read_packet(&mut self) -> Result<Vec<u8>, EncryptionError> {
|
||||
// the first bytes should be the nonce
|
||||
let mut nonce_bytes = [0u8; 12];
|
||||
if let Err(err) = self.socket.read(&mut nonce_bytes) {
|
||||
return Err(IO(err));
|
||||
}
|
||||
self.socket.read(&mut nonce_bytes).map_err(|err| IO(err))?;
|
||||
|
||||
self.reset(nonce_bytes);
|
||||
|
||||
|
|
|
|||
|
|
@ -1,7 +1,6 @@
|
|||
use hermes::EncryptedStream;
|
||||
use std::env::args;
|
||||
use std::io::Write;
|
||||
use std::net::{Shutdown, TcpListener};
|
||||
use std::net::TcpListener;
|
||||
use std::process::exit;
|
||||
|
||||
fn main() {
|
||||
|
|
@ -27,10 +26,6 @@ fn main() {
|
|||
)
|
||||
.unwrap();
|
||||
println!("successfully wrote data");
|
||||
|
||||
encrypted.flush().unwrap();
|
||||
encrypted.shutdown(Shutdown::Both).unwrap();
|
||||
println!("closed connection");
|
||||
}
|
||||
}
|
||||
"c" => {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue