mirror of
https://github.com/tun2proxy/tun2proxy.git
synced 2025-05-14 14:02:45 +00:00
Memory exhaustion (#69)
This commit is contained in:
parent
299b51667d
commit
b50cac82c0
3 changed files with 22 additions and 23 deletions
10
src/http.rs
10
src/http.rs
|
@ -366,15 +366,15 @@ impl ProxyHandler for HttpConnection {
|
|||
self.state == HttpState::Established
|
||||
}
|
||||
|
||||
fn have_data(&mut self, dir: Direction) -> bool {
|
||||
fn data_len(&self, dir: Direction) -> usize {
|
||||
match dir {
|
||||
Direction::Incoming(incoming) => match incoming {
|
||||
IncomingDirection::FromServer => !self.server_inbuf.is_empty(),
|
||||
IncomingDirection::FromClient => !self.client_inbuf.is_empty() || !self.data_buf.is_empty(),
|
||||
IncomingDirection::FromServer => self.server_inbuf.len(),
|
||||
IncomingDirection::FromClient => self.client_inbuf.len().max(self.data_buf.len()),
|
||||
},
|
||||
Direction::Outgoing(outgoing) => match outgoing {
|
||||
OutgoingDirection::ToServer => !self.server_outbuf.is_empty(),
|
||||
OutgoingDirection::ToClient => !self.client_outbuf.is_empty(),
|
||||
OutgoingDirection::ToServer => self.server_outbuf.len(),
|
||||
OutgoingDirection::ToClient => self.client_outbuf.len(),
|
||||
},
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue