OS: Connection: Keep trying select while it gets interrupted (bug #9240)
If we got interrupted (EINTR or EAGAIN) during select, just try again, rather than shutting clients down on either of these errors.
This commit is contained in:
		
							parent
							
								
									d8b2cad377
								
							
						
					
					
						commit
						b7f3618f39
					
				| 
						 | 
				
			
			@ -1057,7 +1057,9 @@ CheckConnections(void)
 | 
			
		|||
	    curclient = curoff + (i * (sizeof(fd_mask)*8));
 | 
			
		||||
            FD_ZERO(&tmask);
 | 
			
		||||
            FD_SET(curclient, &tmask);
 | 
			
		||||
            r = Select (curclient + 1, &tmask, NULL, NULL, ¬ime);
 | 
			
		||||
            do {
 | 
			
		||||
                r = Select (curclient + 1, &tmask, NULL, NULL, ¬ime);
 | 
			
		||||
            } while (r < 0 && (errno == EINTR || errno == EAGAIN));
 | 
			
		||||
            if (r < 0)
 | 
			
		||||
                if (ConnectionTranslation[curclient] > 0)
 | 
			
		||||
                    CloseDownClient(clients[ConnectionTranslation[curclient]]);
 | 
			
		||||
| 
						 | 
				
			
			@ -1071,9 +1073,12 @@ CheckConnections(void)
 | 
			
		|||
	curclient = XFD_FD(&savedAllClients, i);
 | 
			
		||||
	FD_ZERO(&tmask);
 | 
			
		||||
	FD_SET(curclient, &tmask);
 | 
			
		||||
	r = Select (curclient + 1, &tmask, NULL, NULL, ¬ime);
 | 
			
		||||
	if (r < 0 && GetConnectionTranslation(curclient) > 0)
 | 
			
		||||
	    CloseDownClient(clients[GetConnectionTranslation(curclient)]);
 | 
			
		||||
        do {
 | 
			
		||||
            r = Select (curclient + 1, &tmask, NULL, NULL, ¬ime);
 | 
			
		||||
        } while (r < 0 && (errno == EINTR || errno == EAGAIN));
 | 
			
		||||
	if (r < 0)
 | 
			
		||||
            if (GetConnectionTranslation(curclient) > 0)
 | 
			
		||||
                CloseDownClient(clients[GetConnectionTranslation(curclient)]);
 | 
			
		||||
    }	
 | 
			
		||||
#endif
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue