Changeset 3998:872784036bb5 in roaraudio


Ignore:
Timestamp:
06/30/10 23:35:06 (14 years ago)
Author:
phi
Branch:
default
Phase:
public
Message:

do not listen/accept on connection less sockets

File:
1 edited

Legend:

Unmodified
Added
Removed
  • libroar/vio_socket.c

    r3811 r3998  
    4747 int       one_client = 0; 
    4848 int       client; 
     49 int       connection_less = 0; 
    4950 
    5051 if ( calls == NULL || def == NULL ) 
     
    7576     case SOCK_DGRAM: 
    7677       fh = roar_socket_new_udp(); 
     78       connection_less = 1; 
    7779      break; 
    7880     default: 
     
    9092      break; 
    9193     case SOCK_DGRAM: 
     94       connection_less = 1; 
    9295       return -1; 
    9396      break; 
     
    123126     case SOCK_DGRAM: 
    124127       fh = roar_socket_new_udp6(); 
     128       connection_less = 1; 
    125129      break; 
    126130     default: 
     
    149153  } 
    150154 
    151   if ( listen(fh, one_client ? 1 : 16) == -1 ) { 
    152    close(fh); 
    153    return -1; 
    154   } 
    155  
    156   if ( one_client ) { 
    157    client = accept(fh, NULL, NULL); 
    158    close(fh); 
    159  
    160    if ( client == -1 ) { 
     155  if ( !connection_less ) { 
     156   if ( listen(fh, one_client ? 1 : 16) == -1 ) { 
     157    close(fh); 
    161158    return -1; 
    162159   } 
    163160 
    164    fh = client; 
     161   if ( one_client ) { 
     162    client = accept(fh, NULL, NULL); 
     163    close(fh); 
     164 
     165    if ( client == -1 ) { 
     166     return -1; 
     167    } 
     168 
     169    fh = client; 
     170   } 
    165171  } 
    166172 } else { 
Note: See TracChangeset for help on using the changeset viewer.