Changeset 1476:bcb075f757c8 in roaraudio


Ignore:
Timestamp:
03/30/09 19:40:10 (15 years ago)
Author:
phi
Branch:
default
Phase:
public
Message:

do not try BSD Socket interface/POSIX IO if the arch/os does not support that

Location:
libroar
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • libroar/simple.c

    r1470 r1476  
    9999 int fh; 
    100100 
    101  if ( (fh = roar_simple_stream_obj(s, rate, channels, bits, codec, NULL /* server, we hope this goes ok here... */, 
     101 if ( (fh = roar_simple_stream_obj(s, rate, channels, bits, codec, NULL /* server, we hope this is ok here... */, 
    102102                                   dir, "libroar temp stream")) == -1 ) 
    103103  return -1; 
    104104 
    105105 if ( roar_stream_attach_simple(con, s, roar_get_clientid(con)) == -1 ) { 
     106#ifdef ROAR_HAVE_IO_POSIX 
    106107  close(fh); 
     108#endif /* no else as we return -1 anyway */ 
    107109  return -1; 
    108110 } 
     
    143145#endif 
    144146 
     147#ifdef ROAR_HAVE_BSDSOCKETS 
    145148 if ( getsockname(con->fh, (struct sockaddr *)&socket_addr, &len) == -1 ) { 
    146149  return -1; 
    147150 } 
     151#else 
     152 return -1; 
     153#endif 
    148154 
    149155 if ( len == 0 ) { 
     
    323329 
    324330int roar_simple_close(int fh) { 
     331#ifdef ROAR_HAVE_IO_POSIX 
    325332 return close(fh); 
     333#else 
     334 return -1; 
     335#endif 
    326336} 
    327337 
  • libroar/socket.c

    r1443 r1476  
    456456 int ret; 
    457457#endif 
     458#if defined(ROAR_HAVE_IPV4) || defined(ROAR_HAVE_IPV6) || defined(ROAR_HAVE_UNIX) || defined(ROAR_HAVE_IPX) 
    458459 union { 
    459460  struct sockaddr     sa; 
     
    471472#endif 
    472473 } socket_addr; 
     474#endif 
    473475#if defined(ROAR_HAVE_IPV4) || defined(ROAR_HAVE_IPV6) 
    474476 struct hostent     * he; 
     
    626628 } 
    627629 
    628  if ( mode == MODE_LISTEN ) 
     630 if ( mode == MODE_LISTEN ) { 
     631#ifdef ROAR_HAVE_BSDSOCKETS 
    629632  if ( listen(fh, ROAR_SOCKET_QUEUE_LEN) == -1 ) { 
    630633   close(fh); 
    631634   return -1; 
    632635  } 
     636#else 
     637  return -1; 
     638#endif 
     639 } 
    633640 
    634641 return fh; 
     
    682689 
    683690int roar_socket_open_file  (int mode, char * host, int port) { 
     691#ifdef ROAR_HAVE_IO_POSIX 
    684692 int fh; 
    685693 
     
    692700 
    693701 return fh; 
     702#else 
     703 return -1; 
     704#endif 
    694705} 
    695706 
Note: See TracChangeset for help on using the changeset viewer.