🐛 bug: P2 no longer exits when P1 closes the connection
							parent
							
								
									fe25ff3d34
								
							
						
					
					
						commit
						c8e44bb740
					
				|  | @ -27,10 +27,15 @@ async fn main () -> anyhow::Result <()> { | ||||||
| 	let mut resp_buf = [0u8, 0, 0, 0]; | 	let mut resp_buf = [0u8, 0, 0, 0]; | ||||||
| 	recv.read_exact (&mut resp_buf).await?; | 	recv.read_exact (&mut resp_buf).await?; | ||||||
| 	
 | 	
 | ||||||
| 	debug! ("Waiting for local TCP client to connect to us"); |  | ||||||
| 	
 |  | ||||||
| 	let listener = TcpListener::bind ("127.0.0.1:30381").await?; | 	let listener = TcpListener::bind ("127.0.0.1:30381").await?; | ||||||
|  | 	
 | ||||||
|  | 	debug! ("Accepting local TCP connections"); | ||||||
|  | 	
 | ||||||
|  | 	loop { | ||||||
| 		let (tcp_socket, _) = listener.accept ().await?; | 		let (tcp_socket, _) = listener.accept ().await?; | ||||||
|  | 		let connection = connection.clone (); | ||||||
|  | 		
 | ||||||
|  | 		tokio::spawn (async move { | ||||||
| 			let (local_recv, local_send) = tcp_socket.into_split (); | 			let (local_recv, local_send) = tcp_socket.into_split (); | ||||||
| 			
 | 			
 | ||||||
| 			debug! ("Connecting to end server"); | 			debug! ("Connecting to end server"); | ||||||
|  | @ -55,7 +60,9 @@ async fn main () -> anyhow::Result <()> { | ||||||
| 			ptth_conn.uplink_task.await??; | 			ptth_conn.uplink_task.await??; | ||||||
| 			ptth_conn.downlink_task.await??; | 			ptth_conn.downlink_task.await??; | ||||||
| 			
 | 			
 | ||||||
| 	Ok (()) | 			Ok::<_, anyhow::Error> (()) | ||||||
|  | 		}); | ||||||
|  | 	} | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| struct PtthNewConnection { | struct PtthNewConnection { | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue
	
	 _
						_