Skip to content

Commit

Permalink
chore: clean table
Browse files Browse the repository at this point in the history
  • Loading branch information
fengyc committed Jun 13, 2023
1 parent ae49f38 commit 34139d9
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -384,8 +384,8 @@ where
Ok(())
}

async fn connect_plc(args: Arc<Args>, table: Table, stop_rx: EventReceiver) -> Result<()> {
let mut global_stop_rx = stop_rx;
async fn connect_plc(args: Arc<Args>, table: Table, global_stop_rx: EventReceiver) -> Result<()> {
let mut global_stop_rx = global_stop_rx;

// detect plc info
let plc_info = ads::udp::get_info((&args.plc_addr.ip().to_string(), ads::UDP_PORT))?;
Expand Down Expand Up @@ -446,8 +446,8 @@ async fn connect_plc(args: Arc<Args>, table: Table, stop_rx: EventReceiver) -> R
Ok(())
}

async fn accept_client(args: Arc<Args>, table: Table, stop_receiver: EventReceiver) -> Result<()> {
let mut global_stop_rx = stop_receiver;
async fn accept_client(args: Arc<Args>, table: Table, global_stop_rx: EventReceiver) -> Result<()> {
let mut global_stop_rx = global_stop_rx;

let server: TcpListener = TcpListener::bind(args.listen_addr).await?;

Expand Down Expand Up @@ -483,7 +483,6 @@ async fn accept_client(args: Arc<Args>, table: Table, stop_receiver: EventReceiv
if let Err(e) = stop_tx.send(()) {
log::error!("stop client {} error: {}", remote, e);
}
data_tx.send(BytesMut::with_capacity(0)).await;

// clean table
table.write().await.retain(|a, x| {
Expand Down

0 comments on commit 34139d9

Please sign in to comment.