mirror of
https://github.com/aramperes/onetun.git
synced 2025-09-09 06:38:32 -04:00
Don't break TCP connection until all data is flushed
Potential fix for #14
This commit is contained in:
parent
479297f64d
commit
5e6cfe8955
1 changed files with 12 additions and 6 deletions
18
src/main.rs
18
src/main.rs
|
@ -179,10 +179,6 @@ async fn handle_tcp_proxy_connection(
|
||||||
trace!("[{}] Virtual client is ready to send data", virtual_port);
|
trace!("[{}] Virtual client is ready to send data", virtual_port);
|
||||||
|
|
||||||
loop {
|
loop {
|
||||||
if abort.load(Ordering::Relaxed) {
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
tokio::select! {
|
tokio::select! {
|
||||||
readable_result = socket.readable() => {
|
readable_result = socket.readable() => {
|
||||||
match readable_result {
|
match readable_result {
|
||||||
|
@ -234,7 +230,11 @@ async fn handle_tcp_proxy_connection(
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
Err(ref e) if e.kind() == std::io::ErrorKind::WouldBlock => {
|
Err(ref e) if e.kind() == std::io::ErrorKind::WouldBlock => {
|
||||||
continue;
|
if abort.load(Ordering::Relaxed) {
|
||||||
|
break;
|
||||||
|
} else {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
Err(e) => {
|
Err(e) => {
|
||||||
error!(
|
error!(
|
||||||
|
@ -243,7 +243,13 @@ async fn handle_tcp_proxy_connection(
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
None => continue,
|
None => {
|
||||||
|
if abort.load(Ordering::Relaxed) {
|
||||||
|
break;
|
||||||
|
} else {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue