Changeset 3119:9632a77b5f46 in roaraudio
- Timestamp:
- 01/12/10 11:57:50 (14 years ago)
- Branch:
- default
- Phase:
- public
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
libroar/vio_tantalos.c
r3117 r3119 37 37 #define _LEN 1024 38 38 39 static struct roar_slp_cookie * roar_vio_open_get_cookie (int reinit) { 40 static struct roar_slp_cookie cookie; 41 static int inited = 0; 42 43 if ( !inited ) { 44 if ( roar_slp_cookie_init(&cookie, NULL) == -1 ) 45 return NULL; 46 inited++; 47 } 48 49 return &cookie; 50 } 51 39 52 int roar_vio_open_tantalos (struct roar_vio_calls * calls, struct roar_vio_calls * dst, 40 53 char * key, struct roar_vio_defaults * odef) { 41 54 #ifdef ROAR_HAVE_LIBSLP 42 struct roar_slp_cookie 55 struct roar_slp_cookie * cookie; 43 56 char url[_LEN]; 44 57 int i; 58 int need_search = 0; 59 time_t now = time(NULL); 45 60 46 if ( roar_slp_cookie_init(&cookie, NULL) == -1)61 if ( (cookie = roar_vio_open_get_cookie(0)) == NULL ) 47 62 return -1; 48 63 49 if ( roar_slp_search(&cookie, ROAR_SLP_URL_TYPE_DOWNLOAD_HTTP) == -1 ) 50 return -1; 64 if ( cookie->matchcount == 0 ) { 65 need_search++; 66 } else { 67 for (i = 0; i < cookie->matchcount; i++) { 68 if ( cookie->match[i].tod < now ) { 69 need_search++; 70 } 71 } 72 } 51 73 52 for (i = 0; i < cookie.matchcount; i++) { 53 strncpy(url, cookie.match[i].url + ROAR_SLP_URL_TYPE_DOWNLOAD_HTTP_LEN - 4, _LEN); 74 if ( need_search ) { 75 if ( (cookie = roar_vio_open_get_cookie(1)) == NULL ) 76 return -1; 77 if ( roar_slp_search(cookie, ROAR_SLP_URL_TYPE_DOWNLOAD_HTTP) == -1 ) 78 return -1; 79 } 80 81 for (i = 0; i < cookie->matchcount; i++) { 82 strncpy(url, cookie->match[i].url + ROAR_SLP_URL_TYPE_DOWNLOAD_HTTP_LEN - 4, _LEN); 54 83 strcat(url, key); 55 84
Note: See TracChangeset
for help on using the changeset viewer.