Changeset 4806:988c888752c2 in roaraudio
- Timestamp:
- 03/25/11 03:40:16 (13 years ago)
- Branch:
- default
- Phase:
- public
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
ChangeLog
r4803 r4806 1 v. 0.4beta5 - ? 2 * Started with support for non-blocking server locating attempts. 3 * Speed up SLP lookup without DA by about 6 sec. 4 1 5 v. 0.4beta4 - Sun Mar 20 2011 12:15 CET 2 6 Prereleases: 0: Thu Feb 24 2011 27:36 CET; -
include/libroar/basic.h
r4708 r4806 77 77 78 78 int roar_connect_raw (char * server); 79 int roar_connect_raw2 (char * server, int flags, uint_least32_t timeout); 79 80 80 81 int roar_connect (struct roar_connection * con, char * server); 82 int roar_connect2 (struct roar_connection * con, char * server, int flags, uint_least32_t timeout); 81 83 int roar_connect_fh (struct roar_connection * con, int fh); 82 84 int roar_get_connection_fh (struct roar_connection * con); -
include/libroar/simple.h
r4708 r4806 40 40 41 41 int roar_simple_connect (struct roar_connection * con, char * server, char * name); 42 int roar_simple_connect2(struct roar_connection * con, char * server, char * name, int flags, uint_least32_t timeout); 42 43 43 44 int roar_simple_stream (int rate, int channels, int bits, int codec, char * server, int dir, char * name); -
libroar/basic.c
r4780 r4806 37 37 38 38 int roar_connect_raw (char * server) { 39 return roar_connect_raw2(server, 0, 0); 40 } 41 42 int roar_connect_raw2 (char * server, int flags, uint_least32_t timeout) { 39 43 #ifdef ROAR_HAVE_LIBSLP 40 44 struct roar_libroar_config * config = roar_libroar_get_config(); … … 56 60 struct roar_x11_connection * x11con; 57 61 #endif 62 struct roar_server * list; 63 int workarounds_store; 58 64 59 65 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 60 75 61 76 if ( server == NULL ) … … 136 151 137 152 #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 ) { 140 157 if ( (fh = roar_connect_raw(server)) != -1 ) 141 158 return fh; 142 159 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); 148 177 return fh; 178 } 179 } 180 roar_enum_servers_free(list); 149 181 } 150 182 #endif … … 207 239 208 240 int roar_connect (struct roar_connection * con, char * server) { 241 return roar_connect2(con, server, 0, 0); 242 } 243 244 int roar_connect2 (struct roar_connection * con, char * server, int flags, uint_least32_t timeout) { 209 245 int fh; 210 246 … … 215 251 216 252 roar_errno = ROAR_ERROR_UNKNOWN; 217 fh = roar_connect_raw (server);253 fh = roar_connect_raw2(server, flags, timeout); 218 254 219 255 if ( fh == -1 ) -
libroar/simple.c
r4708 r4806 37 37 38 38 int roar_simple_connect (struct roar_connection * con, char * server, char * name) { 39 return roar_simple_connect2(con, server, name, 0, 0); 40 } 41 42 int roar_simple_connect2(struct roar_connection * con, char * server, char * name, int flags, uint_least32_t timeout) { 39 43 40 44 ROAR_DBG("roar_simple_connect(*): trying to connect..."); 41 45 42 if ( roar_connect (con, server) == -1 ) {46 if ( roar_connect2(con, server, flags, timeout) == -1 ) { 43 47 ROAR_DBG("roar_simple_connect(*): roar_connect() faild!"); 44 48 return -1;
Note: See TracChangeset
for help on using the changeset viewer.