Skip to content

Commit

Permalink
Refactor net::PortForwarder to reduce handle fn
Browse files Browse the repository at this point in the history
This change reduces the code size of `handle` fn inside `PortForwarder`
by moving the code inside it to new functions `handle_plaintext`,
`handle_encrypt` and `handle_decrypt`. This makes the code more
readable and easier to understand. Also, common code between
`handle_encrypt` and `handle_decrypt` is moved to two new functions
`initiator_handshake` and `responder_handshake`. All the changes
are made without changing the functionality of the code and as such
should not break anything and should be compatible with the previous
commit.
  • Loading branch information
mobi-nex committed Jan 6, 2023
1 parent fc9a075 commit 3ca0d33
Show file tree
Hide file tree
Showing 3 changed files with 193 additions and 183 deletions.
2 changes: 1 addition & 1 deletion src/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -274,7 +274,7 @@ pub enum ConsumerCommands {
},
/// Stop device screen mirroring for a device.
/// Note: This doesn't work if the Consumer and Supplier are on the same machine.
/// see: https://github.com/mobi-nex/adborc/issues/16 for more information.
/// see: https://github.com/mobi-nex/adborc/issues/16 for more information.
StopScrcpy {
/// `device_id` of the device to stop scrcpy for.
#[clap(value_parser)]
Expand Down
1 change: 0 additions & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,6 @@
//! net::TCPClient,
//! util::SysStateDefaultConfig
//! };
//! # use serde_json;
//!
//! // start the system in a separate thread.
//! thread::spawn(|| SysState::start_system().unwrap());
Expand Down
Loading

0 comments on commit 3ca0d33

Please sign in to comment.