diff --git a/src/http.rs b/src/http.rs index 8e75d5c..3db3787 100644 --- a/src/http.rs +++ b/src/http.rs @@ -311,6 +311,7 @@ impl HttpConnection { } HttpState::Reset => { self.state = HttpState::ExpectResponseHeaders; + return self.state_change(); } _ => {} } diff --git a/src/tun2proxy.rs b/src/tun2proxy.rs index 58b47ce..6bc9529 100644 --- a/src/tun2proxy.rs +++ b/src/tun2proxy.rs @@ -748,24 +748,18 @@ impl<'a> TunToProxy<'a> { // The handler request for reset the server connection if state.handler.reset_connection() { + _ = self.poll.registry().deregister(&mut state.mio_stream); // Closes the connection with the proxy state.mio_stream.shutdown(Both)?; - info!("RESETED {}", connection); + info!("RESET {}", connection); - // TODO: Improve the call upstairs state.mio_stream = TcpStream::connect(server)?; - _ = self.poll.registry().deregister(&mut state.mio_stream); - self.poll.registry().register( - &mut state.mio_stream, - state.token, - Interest::WRITABLE, - )?; - state.wait_read = true; state.wait_write = true; - state.close_state = 0; + + self.update_mio_socket_interest(&connection)?; return Ok(()); }