Changeset 3769:14c294155cad in roaraudio for libroar/vio.c


Ignore:
Timestamp:
05/05/10 10:55:36 (14 years ago)
Author:
phi
Branch:
default
Phase:
public
Message:

support to accept on sockets

File:
1 edited

Legend:

Unmodified
Added
Removed
  • libroar/vio.c

    r3517 r3769  
    174174} 
    175175 
     176// specal commands: 
     177int     roar_vio_accept  (struct roar_vio_calls * calls, struct roar_vio_calls * dst) { 
     178 if (dst == NULL || calls == NULL) 
     179  return -1; 
     180 
     181 return roar_vio_ctl(dst, ROAR_VIO_CTL_ACCEPT, calls); 
     182} 
     183 
    176184// converters: 
    177185int     roar_vio_open_file     (struct roar_vio_calls * calls, char * filename, int flags, mode_t mode) { 
     
    331339 
    332340int     roar_vio_basic_ctl     (struct roar_vio_calls * vio, int cmd, void * data) { 
     341 int fh; 
    333342 
    334343 if ( vio == NULL || cmd == -1 ) 
     
    352361    return 0; 
    353362   break; 
     363  case ROAR_VIO_CTL_ACCEPT: 
     364    fh = accept(roar_vio_get_fh(vio), NULL, 0); 
     365    if ( fh == -1 ) 
     366     return -1; 
     367 
     368    // most proably a socket. 
     369    if ( roar_vio_open_fh_socket(data, fh) == -1 ) { 
     370#ifdef ROAR_TARGET_WIN32 
     371     closesocket(fh); 
     372#else 
     373     close(fh); 
     374#endif 
     375     return -1; 
     376    } 
     377 
     378    return 0; 
     379   break; 
    354380 } 
    355381 
Note: See TracChangeset for help on using the changeset viewer.