Changeset 2014:6646d9a2113a in roaraudio


Ignore:
Timestamp:
06/16/09 13:26:54 (15 years ago)
Author:
phi
Branch:
default
Phase:
public
Message:

support to force non caching on SLP lookup

Files:
3 edited

Legend:

Unmodified
Added
Removed
  • include/libroar/roarslp.h

    r2012 r2014  
    7474int roar_slp_cookie_init     (struct roar_slp_cookie * cookie, struct roar_slp_search * search); 
    7575 
    76 char * roar_slp_find_roard   (void); 
    77 int    roar_slp_find_roard_r (char * addr, size_t len); 
     76char * roar_slp_find_roard   (int nocache); 
     77int    roar_slp_find_roard_r (char * addr, size_t len, int nocache); 
    7878 
    7979#endif 
  • libroar/basic.c

    r2010 r2014  
    107107 
    108108#ifdef ROAR_HAVE_LIBSLP 
    109  if ( (server = roar_slp_find_roard()) != NULL ) { 
    110   return roar_connect_raw(server); 
    111  } else { 
    112   return -1; 
    113  } 
    114 #endif 
     109 if ( (server = roar_slp_find_roard(0)) != NULL ) 
     110  if ( (fh = roar_connect_raw(server)) != -1 ) 
     111   return fh; 
     112 
     113 /* in case we can not connect to the server given this may be a cache problem, 
     114    we do a new lookup with the cache disabled in this case                     */ 
     115 ROAR_WARN("roar_connect_raw(*): Can not connect to SLP located server, disabling cache"); 
     116 if ( (server = roar_slp_find_roard(1)) != NULL ) 
     117  if ( (fh = roar_connect_raw(server)) != -1 ) 
     118   return fh; 
     119#endif 
     120 
     121 return -1; 
    115122 
    116123 } else { 
  • libroar/slp.c

    r2013 r2014  
    136136 
    137137 
    138 char * roar_slp_find_roard   (void) { 
     138char * roar_slp_find_roard   (int nocache) { 
    139139 static char addr[80]; 
    140140 
    141  if ( roar_slp_find_roard_r(addr, 80) == -1 ) 
     141 if ( roar_slp_find_roard_r(addr, 80, nocache) == -1 ) 
    142142  return NULL; 
    143143 
     
    145145} 
    146146 
    147 int    roar_slp_find_roard_r (char * addr, size_t len) { 
     147int    roar_slp_find_roard_r (char * addr, size_t len, int nocache) { 
    148148 static struct roar_slp_match    cache  = {"", 0}; 
    149149        struct roar_slp_cookie   cookie; 
     
    158158 *addr = 0; // just in case... 
    159159 
    160  if ( cache.tod < time(NULL) ) { 
     160 if ( nocache || cache.tod < time(NULL) ) { 
     161  if ( nocache ) { 
     162   ROAR_WARN("roar_slp_find_roard_r(*): forced ignoring of cache, doing a new lookup."); 
     163  } 
    161164  ROAR_WARN("roar_slp_find_roard_r(*): cache too old, searching for a new server..."); 
    162165  ROAR_DBG("roar_slp_find_roard_r(*) = ?"); 
Note: See TracChangeset for help on using the changeset viewer.