Changeset 1161:3a4d2d9604ae in roaraudio for libroar/simple.c


Ignore:
Timestamp:
01/24/09 01:26:07 (15 years ago)
Author:
phi
Branch:
default
Phase:
public
Message:

added a 10 sec timeout for creating new streams via connect_to

File:
1 edited

Legend:

Unmodified
Added
Removed
  • libroar/simple.c

    r1158 r1161  
    112112 struct sockaddr_in   socket_addr; 
    113113 socklen_t            len            = sizeof(struct sockaddr_in); 
     114 fd_set fds; 
     115 struct timeval timeout = {10, 0}; 
    114116 
    115117 if ( getsockname(con->fh, (struct sockaddr *)&socket_addr, &len) == -1 ) { 
     
    178180 if ( roar_stream_connect_to_ask(con, s, type, file, port) != -1 ) { 
    179181 
     182  FD_ZERO(&fds); 
     183  FD_SET(listen, &fds); 
     184 
     185  if ( select(listen + 1, &fds, &fds, &fds, &timeout) < 1 ) { 
     186   close(listen); 
     187   if ( roar_kick(con, ROAR_OT_STREAM, s->id) == -1 ) 
     188    return -1; 
     189 
     190   return -1; 
     191  } 
     192 
    180193  if ( (fh = accept(listen, NULL, NULL)) != -1 ) { 
    181194   if ( dir == ROAR_DIR_PLAY ) { 
Note: See TracChangeset for help on using the changeset viewer.