mirror of
https://github.com/tun2proxy/tun2proxy.git
synced 2025-06-11 00:49:34 +00:00
minor changes
This commit is contained in:
parent
a54e6ae23e
commit
03aa70f3c2
1 changed files with 4 additions and 4 deletions
|
@ -567,7 +567,7 @@ impl<'a> TunToProxy<'a> {
|
|||
assert!(state.dns_over_tcp_expiry.is_some());
|
||||
state.dns_over_tcp_expiry = Some(Self::common_udp_life_timeout());
|
||||
|
||||
let vecbuf = Self::read_data_from_tcp_stream(&mut state.mio_stream, info)?;
|
||||
let vecbuf = Self::read_data_from_tcp_stream(&mut state.mio_stream)?;
|
||||
|
||||
let data_event = IncomingDataEvent {
|
||||
direction: IncomingDirection::FromServer,
|
||||
|
@ -1029,7 +1029,7 @@ impl<'a> TunToProxy<'a> {
|
|||
let state = self.connection_map.get_mut(&conn_info).ok_or(e)?;
|
||||
|
||||
// TODO: Move this reading process to its own function.
|
||||
let vecbuf = Self::read_data_from_tcp_stream(&mut state.mio_stream, &conn_info)?;
|
||||
let vecbuf = Self::read_data_from_tcp_stream(&mut state.mio_stream)?;
|
||||
|
||||
let data_event = IncomingDataEvent {
|
||||
direction: IncomingDirection::FromServer,
|
||||
|
@ -1095,13 +1095,13 @@ impl<'a> TunToProxy<'a> {
|
|||
Ok(())
|
||||
}
|
||||
|
||||
fn read_data_from_tcp_stream(stream: &mut TcpStream, conn_info: &ConnectionInfo) -> Result<Vec<u8>> {
|
||||
fn read_data_from_tcp_stream(stream: &mut TcpStream) -> Result<Vec<u8>> {
|
||||
let mut vecbuf = Vec::<u8>::new();
|
||||
loop {
|
||||
let mut tmp: [u8; 4096] = [0_u8; 4096];
|
||||
match stream.read(&mut tmp) {
|
||||
Ok(0) => {
|
||||
log::info!("{} closed", conn_info);
|
||||
// The tcp connection closed
|
||||
break;
|
||||
}
|
||||
Ok(read_result) => {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue