Changeset 5373:8da157c10483 in roaraudio for libroar/basic.c
- Timestamp:
- 12/21/11 19:02:52 (12 years ago)
- Branch:
- default
- Phase:
- public
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
libroar/basic.c
r5369 r5373 64 64 } 65 65 66 // TODO: FIXME: we should move this into the config structure.67 66 if ( daemonimage == NULL ) 67 daemonimage = roar_libroar_get_config()->daemonimage; 68 69 // we keep this step to be compatible with older versions. 70 if ( daemonimage == NULL || *daemonimage == 0 ) { 68 71 daemonimage = getenv("ROAR_DAEMONIMAGE"); 72 if ( daemonimage != NULL ) { 73 ROAR_WARN("_start_server(*): Usage of $ROAR_DAEMONIMAGE is obsolete. Use ROAR_OPTIONS=daemonimage:..."); 74 } 75 } 69 76 70 77 if ( daemonimage == NULL || *daemonimage == 0 ) … … 76 83 } 77 84 78 r = fork();85 r = roar_fork(NULL); 79 86 80 87 if ( r == -1 ) { // error! 81 roar_err_from_errno(); 82 ROAR_ERR("roar_socket_open_fork(*): Can not fork: %s", strerror(errno)); 88 ROAR_ERR("_start_server(*): Can not fork: %s", roar_error2str(roar_error)); 83 89 close(socks[0]); 84 90 close(socks[1]); … … 106 112 107 113 // we are still alive? 108 ROAR_ERR(" roar_socket_open_fork(*): alive after exec(), that's bad!");114 ROAR_ERR("_start_server(*): alive after exec(), that's bad!"); 109 115 _exit(1); 110 116 } else { // we are the parent … … 121 127 return -1; 122 128 #else 123 ROAR_ERR(" roar_socket_open_fork(*): There is no UNIX Domain Socket support in win32, download a real OS.");129 ROAR_ERR("_start_server(*): There is no UNIX Domain Socket support in win32, download a real OS."); 124 130 return -1; 125 131 #endif 132 } 133 134 static int _connect_internal(struct roar_connection * con, const char * server, int type, int flags, uint_least32_t timeout) { 135 struct roar_libroar_config * config = roar_libroar_get_config(); 136 struct roar_vio_calls * vio; 137 138 if ( config->connect_internal != NULL ) { 139 vio = config->connect_internal(con, server, type, flags, timeout); 140 if ( vio == NULL ) 141 return -1; 142 143 con->viocon = vio; 144 con->flags |= ROAR_CON_FLAGS_VIO; 145 146 return 0; 147 } 148 149 roar_err_set(ROAR_ERROR_BADHOST); 150 return -1; 126 151 } 127 152 … … 153 178 } else if ( !strcmp(server, "+fork") || !strncmp(server, "+fork=", 6) ) { 154 179 return _start_server(con, server, type, flags, timeout); 180 } else if ( !strcmp(server, "+internal") || !strncmp(server, "+internal=", 10) ) { 181 return _connect_internal(con, server, type, flags, timeout); 155 182 } 156 183 … … 346 373 #ifdef ROAR_HAVE_LIBSLP 347 374 if ( !(config->workaround.workarounds & ROAR_LIBROAR_CONFIG_WAS_NO_SLP) && 348 !(flags & ROAR_ENUM_FLAG_NONBLOCK) 375 !(flags & ROAR_ENUM_FLAG_NONBLOCK) && 376 !(flags & ROAR_ENUM_FLAG_LOCALONLY) 349 377 ) { 350 378 if ( (server = roar_slp_find_roard(0)) != NULL ) { … … 391 419 392 420 int roar_connect (struct roar_connection * con, const char * server, int flags, uint_least32_t timeout) { 421 struct roar_libroar_config * config = roar_libroar_get_config(); 422 393 423 if ( con == NULL ) { 394 424 roar_err_set(ROAR_ERROR_FAULT); … … 400 430 401 431 roar_err_set(ROAR_ERROR_UNKNOWN); 402 if ( roar_connect_raw(con, server, flags, timeout) == -1 ) 403 return -1; 404 432 if ( roar_connect_raw(con, server, flags | config->serverflags, timeout) == -1 ) 433 return -1; 434 435 // TODO: this should be moved to be within _connect_server() so it also stores server names of auto located servers. 405 436 if ( server != NULL ) { 406 437 con->server_name = roar_mm_strdup(server);
Note: See TracChangeset
for help on using the changeset viewer.