mirror of
				https://github.com/cuberite/polarssl.git
				synced 2025-10-30 19:20:40 -04:00 
			
		
		
		
	Make udp_proxy more robust
There seemed to be some race conditions with server closing its fd right after sending HelloVerifyRequest causing the proxy to exit after a failed read.
This commit is contained in:
		
							parent
							
								
									6093d81c20
								
							
						
					
					
						commit
						ce8588c9ef
					
				| @ -545,6 +545,9 @@ accept: | |||||||
|     /*
 |     /*
 | ||||||
|      * 3. Forward packets forever (kill the process to terminate it) |      * 3. Forward packets forever (kill the process to terminate it) | ||||||
|      */ |      */ | ||||||
|  |     clear_pending(); | ||||||
|  |     memset( dropped, 0, sizeof( dropped ) ); | ||||||
|  | 
 | ||||||
|     nb_fds = client_fd; |     nb_fds = client_fd; | ||||||
|     if( nb_fds < server_fd ) |     if( nb_fds < server_fd ) | ||||||
|         nb_fds = server_fd; |         nb_fds = server_fd; | ||||||
| @ -566,24 +569,20 @@ accept: | |||||||
|         } |         } | ||||||
| 
 | 
 | ||||||
|         if( FD_ISSET( listen_fd, &read_fds ) ) |         if( FD_ISSET( listen_fd, &read_fds ) ) | ||||||
|         { |  | ||||||
|             clear_pending(); |  | ||||||
|             memset( dropped, 0, sizeof( dropped ) ); |  | ||||||
|             goto accept; |             goto accept; | ||||||
|         } |  | ||||||
| 
 | 
 | ||||||
|         if( FD_ISSET( client_fd, &read_fds ) ) |         if( FD_ISSET( client_fd, &read_fds ) ) | ||||||
|         { |         { | ||||||
|             if( ( ret = handle_message( "S <- C", |             if( ( ret = handle_message( "S <- C", | ||||||
|                                         server_fd, client_fd ) ) != 0 ) |                                         server_fd, client_fd ) ) != 0 ) | ||||||
|                 goto exit; |                 goto accept; | ||||||
|         } |         } | ||||||
| 
 | 
 | ||||||
|         if( FD_ISSET( server_fd, &read_fds ) ) |         if( FD_ISSET( server_fd, &read_fds ) ) | ||||||
|         { |         { | ||||||
|             if( ( ret = handle_message( "S -> C", |             if( ( ret = handle_message( "S -> C", | ||||||
|                                         client_fd, server_fd ) ) != 0 ) |                                         client_fd, server_fd ) ) != 0 ) | ||||||
|                 goto exit; |                 goto accept; | ||||||
|         } |         } | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user
	 Manuel Pégourié-Gonnard
						Manuel Pégourié-Gonnard