Manage the bits that'll go into select(2) or whatevs
This commit is contained in:
		
							parent
							
								
									a76ea9125a
								
							
						
					
					
						commit
						5fb55973ad
					
				
					 2 changed files with 9 additions and 0 deletions
				
			
		| 
						 | 
				
			
			@ -59,6 +59,7 @@ struct _patty_ax25 {
 | 
			
		|||
    patty_list * ifaces;
 | 
			
		||||
    patty_list * socks;
 | 
			
		||||
 | 
			
		||||
    int    unix_fdmax;
 | 
			
		||||
    fd_set unix_fds;
 | 
			
		||||
 | 
			
		||||
    patty_dict * fd_lookup;
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
							
								
								
									
										8
									
								
								src/if.c
									
										
									
									
									
								
							
							
						
						
									
										8
									
								
								src/if.c
									
										
									
									
									
								
							| 
						 | 
				
			
			@ -240,6 +240,10 @@ int patty_ax25_add_if(patty_ax25 *ax25, patty_ax25_if *iface) {
 | 
			
		|||
 | 
			
		||||
    if ((fd = patty_kiss_tnc_fd_unix(iface->tnc)) >= 0) {
 | 
			
		||||
        FD_SET(fd, &ax25->unix_fds);
 | 
			
		||||
 | 
			
		||||
        if (ax25->unix_fdmax < fd) {
 | 
			
		||||
            ax25->unix_fdmax = fd;
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    if (patty_list_append(ax25->ifaces, iface) == NULL) {
 | 
			
		||||
| 
						 | 
				
			
			@ -272,6 +276,10 @@ int patty_ax25_delete_if(patty_ax25 *ax25, patty_ax25_if *iface) {
 | 
			
		|||
 | 
			
		||||
    if ((fd = patty_kiss_tnc_fd_unix(iface->tnc)) >= 0) {
 | 
			
		||||
        FD_CLR(fd, &ax25->unix_fds);
 | 
			
		||||
 | 
			
		||||
        if (ax25->unix_fdmax == fd) {
 | 
			
		||||
            ax25->unix_fdmax--;
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    return 0;
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		
		Reference in a new issue