@@ -104,20 +104,19 @@ impl Proxy {
104104 Ok ( conn) => {
105105 let connection_id = conn. id ;
106106 let remote_ip = conn. ip . clone ( ) ;
107- println ! ( "called new_from_name successfully. Saving connection ID {connection_id}..." ) ;
108107 match self . save_connection ( conn) {
109108 Ok ( ( ) ) => {
110- println ! ( "Connection established and saved. Returning ConnectResponse to client " ) ;
109+ println ! ( "Connection to {hostname} established and saved as ID {connection_id} " ) ;
111110 ProxyMsg :: ConnectResponse { connection_id, remote_ip }
112111 }
113112 Err ( e) => {
114- println ! ( "error saving connection. " ) ;
113+ println ! ( "error saving connection: {e:?} " ) ;
115114 ProxyMsg :: ProxyError ( e)
116115 }
117116 }
118117 }
119118 Err ( e) => {
120- println ! ( "error calling new_from_name " ) ;
119+ println ! ( "error while establishing connection: {e:?} " ) ;
121120 ProxyMsg :: ProxyError ( e)
122121 }
123122 }
@@ -126,18 +125,25 @@ impl Proxy {
126125 /// Create a new connection, targeting an IP address directly.
127126 /// address. The TCP connection is opened and saved in internal state.
128127 pub fn connect_by_ip ( & mut self , ip : String , port : u16 ) -> ProxyMsg {
129- match proxy_connection:: ProxyConnection :: new_from_ip ( ip, port) {
128+ match proxy_connection:: ProxyConnection :: new_from_ip ( ip. clone ( ) , port) {
130129 Ok ( conn) => {
131130 let connection_id = conn. id ;
132131 let remote_ip = conn. ip . clone ( ) ;
133132 match self . save_connection ( conn) {
134133 Ok ( ( ) ) => {
134+ println ! ( "Connection to {ip} established and saved as ID {connection_id}" ) ;
135135 ProxyMsg :: ConnectResponse { connection_id, remote_ip }
136136 }
137- Err ( e) => ProxyMsg :: ProxyError ( e) ,
137+ Err ( e) => {
138+ println ! ( "error saving connection: {e:?}" ) ;
139+ ProxyMsg :: ProxyError ( e)
140+ }
138141 }
139142 }
140- Err ( e) => ProxyMsg :: ProxyError ( e) ,
143+ Err ( e) => {
144+ println ! ( "error while establishing connection: {e:?}" ) ;
145+ ProxyMsg :: ProxyError ( e)
146+ }
141147 }
142148 }
143149
@@ -207,7 +213,6 @@ impl Proxy {
207213
208214impl server:: RequestProcessor for Proxy {
209215 fn process ( & mut self , req_bytes : Vec < u8 > ) -> Vec < u8 > {
210- println ! ( "Proxy processing request" ) ;
211216 if req_bytes. len ( ) > MAX_ENCODED_MSG_LEN {
212217 return ProxyMsg :: ProxyError ( QosNetError :: OversizedPayload )
213218 . try_to_vec ( )
@@ -217,43 +222,32 @@ impl server::RequestProcessor for Proxy {
217222 let resp = match ProxyMsg :: try_from_slice ( & req_bytes) {
218223 Ok ( req) => match req {
219224 ProxyMsg :: StatusRequest => {
220- println ! ( "Proxy processing StatusRequest" ) ;
221225 ProxyMsg :: StatusResponse ( self . connections . len ( ) )
222226 }
223227 ProxyMsg :: ConnectByNameRequest {
224228 hostname,
225229 port,
226230 dns_resolvers,
227231 dns_port,
228- } => {
229- println ! ( "Proxy connecting to {hostname}:{port}" ) ;
230- let resp = self . connect_by_name (
231- hostname. clone ( ) ,
232- port,
233- dns_resolvers,
234- dns_port,
235- ) ;
236- println ! ( "Proxy connected to {hostname}:{port}" ) ;
237- resp
238- }
232+ } => self . connect_by_name (
233+ hostname. clone ( ) ,
234+ port,
235+ dns_resolvers,
236+ dns_port,
237+ ) ,
239238 ProxyMsg :: ConnectByIpRequest { ip, port } => {
240- println ! ( "Proxy connecting to {ip}:{port}" ) ;
241239 self . connect_by_ip ( ip, port)
242240 }
243241 ProxyMsg :: CloseRequest { connection_id } => {
244- println ! ( "Proxy closing connection {connection_id}" ) ;
245242 self . close ( connection_id)
246243 }
247244 ProxyMsg :: ReadRequest { connection_id, size } => {
248- println ! ( "Proxy reading {size} bytes from connection {connection_id}" ) ;
249245 self . read ( connection_id, size)
250246 }
251247 ProxyMsg :: WriteRequest { connection_id, data } => {
252- println ! ( "Proxy writing to connection {connection_id}" ) ;
253248 self . write ( connection_id, data)
254249 }
255250 ProxyMsg :: FlushRequest { connection_id } => {
256- println ! ( "Proxy flushing connection {connection_id}" ) ;
257251 self . flush ( connection_id)
258252 }
259253 ProxyMsg :: ProxyError ( _) => {
0 commit comments