Changeset 4806:988c888752c2 in roaraudio


Ignore:
Timestamp:
03/25/11 03:40:16 (13 years ago)
Author:
phi
Branch:
default
Phase:
public
Message:

Started with support for non-blocking server locating attempts.
Speed up SLP lookup without DA by about 6 sec.

Files:
5 edited

Legend:

Unmodified
Added
Removed
  • ChangeLog

    r4803 r4806  
     1v. 0.4beta5 - ? 
     2        * Started with support for non-blocking server locating attempts. 
     3        * Speed up SLP lookup without DA by about 6 sec. 
     4 
    15v. 0.4beta4 - Sun Mar 20 2011 12:15 CET 
    26        Prereleases: 0: Thu Feb 24 2011 27:36 CET; 
  • include/libroar/basic.h

    r4708 r4806  
    7777 
    7878int roar_connect_raw  (char * server); 
     79int roar_connect_raw2 (char * server, int flags, uint_least32_t timeout); 
    7980 
    8081int roar_connect      (struct roar_connection * con, char * server); 
     82int roar_connect2     (struct roar_connection * con, char * server, int flags, uint_least32_t timeout); 
    8183int roar_connect_fh   (struct roar_connection * con, int fh); 
    8284int roar_get_connection_fh  (struct roar_connection * con); 
  • include/libroar/simple.h

    r4708 r4806  
    4040 
    4141int roar_simple_connect (struct roar_connection * con, char * server, char * name); 
     42int roar_simple_connect2(struct roar_connection * con, char * server, char * name, int flags, uint_least32_t timeout); 
    4243 
    4344int roar_simple_stream  (int rate, int channels, int bits, int codec, char * server, int dir, char * name); 
  • libroar/basic.c

    r4780 r4806  
    3737 
    3838int roar_connect_raw (char * server) { 
     39 return roar_connect_raw2(server, 0, 0); 
     40} 
     41 
     42int roar_connect_raw2 (char * server, int flags, uint_least32_t timeout) { 
    3943#ifdef ROAR_HAVE_LIBSLP 
    4044 struct roar_libroar_config * config = roar_libroar_get_config(); 
     
    5660 struct roar_x11_connection * x11con; 
    5761#endif 
     62 struct roar_server * list; 
     63 int workarounds_store; 
    5864 
    5965 roar_errno = ROAR_ERROR_UNKNOWN; 
     66 
     67 if ( timeout != 0 ) { 
     68  roar_errno = ROAR_ERROR_INVAL; 
     69  return -1; 
     70 } 
     71 
     72 if ( flags & ROAR_ENUM_FLAG_HARDNONBLOCK ) 
     73  flags |= ROAR_ENUM_FLAG_NONBLOCK; 
     74 
    6075 
    6176 if ( server == NULL ) 
     
    136151 
    137152#ifdef ROAR_HAVE_LIBSLP 
    138  if ( !(config->workaround.workarounds & ROAR_LIBROAR_CONFIG_WAS_NO_SLP) ) { 
    139   if ( (server = roar_slp_find_roard(0)) != NULL ) 
     153 if ( !(config->workaround.workarounds & ROAR_LIBROAR_CONFIG_WAS_NO_SLP) && 
     154      !(flags & ROAR_ENUM_FLAG_NONBLOCK) 
     155    ) { 
     156  if ( (server = roar_slp_find_roard(0)) != NULL ) { 
    140157   if ( (fh = roar_connect_raw(server)) != -1 ) 
    141158    return fh; 
    142159 
    143   /* in case we can not connect to the server given this may be a cache problem, 
    144      we do a new lookup with the cache disabled in this case                     */ 
    145   ROAR_WARN("roar_connect_raw(*): Can not connect to SLP located server, disabling cache"); 
    146   if ( (server = roar_slp_find_roard(1)) != NULL ) 
    147    if ( (fh = roar_connect_raw(server)) != -1 ) 
     160   /* in case we can not connect to the server given this may be a cache problem, 
     161      we do a new lookup with the cache disabled in this case                     */ 
     162   ROAR_WARN("roar_connect_raw(*): Can not connect to SLP located server, disabling cache"); 
     163   if ( (server = roar_slp_find_roard(1)) != NULL ) 
     164    if ( (fh = roar_connect_raw(server)) != -1 ) 
     165     return fh; 
     166  } 
     167 } 
     168 
     169 workarounds_store = config->workaround.workarounds; 
     170 config->workaround.workarounds |= ROAR_LIBROAR_CONFIG_WAS_NO_SLP; 
     171 list = roar_enum_servers(flags, -1, -1); 
     172 config->workaround.workarounds = workarounds_store; 
     173 if ( list != NULL ) { 
     174  for (i = 0; list[i].server != NULL; i++) { 
     175   if ( (fh = roar_connect_raw((char*)list[i].server)) != -1 ) { 
     176    roar_enum_servers_free(list); 
    148177    return fh; 
     178   } 
     179  } 
     180  roar_enum_servers_free(list); 
    149181 } 
    150182#endif 
     
    207239 
    208240int roar_connect    (struct roar_connection * con, char * server) { 
     241 return roar_connect2(con, server, 0, 0); 
     242} 
     243 
     244int roar_connect2     (struct roar_connection * con, char * server, int flags, uint_least32_t timeout) { 
    209245 int fh; 
    210246 
     
    215251 
    216252 roar_errno = ROAR_ERROR_UNKNOWN; 
    217  fh = roar_connect_raw(server); 
     253 fh = roar_connect_raw2(server, flags, timeout); 
    218254 
    219255 if ( fh == -1 ) 
  • libroar/simple.c

    r4708 r4806  
    3737 
    3838int roar_simple_connect (struct roar_connection * con, char * server, char * name) { 
     39 return roar_simple_connect2(con, server, name, 0, 0); 
     40} 
     41 
     42int roar_simple_connect2(struct roar_connection * con, char * server, char * name, int flags, uint_least32_t timeout) { 
    3943 
    4044 ROAR_DBG("roar_simple_connect(*): trying to connect..."); 
    4145 
    42  if ( roar_connect(con, server) == -1 ) { 
     46 if ( roar_connect2(con, server, flags, timeout) == -1 ) { 
    4347  ROAR_DBG("roar_simple_connect(*): roar_connect() faild!"); 
    4448  return -1; 
Note: See TracChangeset for help on using the changeset viewer.