Changeset 1494:687defe4fca9 in roaraudio
- Timestamp:
- 03/31/09 20:04:32 (15 years ago)
- Branch:
- default
- Phase:
- public
- Location:
- roard
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
roard/include/roard.h
r1482 r1494 78 78 79 79 int alive; 80 #ifdef ROAR_SUPPORT_LISTEN 80 81 int g_no_listen; 82 #endif 81 83 82 84 uint32_t g_pos; // current possition in output stream … … 93 95 void on_sig_chld (int signum); 94 96 97 #ifdef ROAR_SUPPORT_LISTEN 95 98 int g_listen_socket; 99 #endif 96 100 97 101 int g_self_client; -
roard/loop.c
r1488 r1494 58 58 ROAR_DBG("main_loop(*): looping..."); 59 59 60 #ifdef ROAR_SUPPORT_LISTEN 60 61 if ( g_listen_socket != -1 ) { 61 62 ROAR_DBG("main_loop(*): check for new clients..."); 62 63 net_check_listen(); 63 64 } 65 #endif 64 66 65 67 ROAR_DBG("main_loop(*): check for new data..."); 68 #ifdef ROAR_SUPPORT_LISTEN 66 69 if ( clients_check_all() == 0 && g_terminate && g_listen_socket == -1 ) { 70 #else 71 if ( clients_check_all() == 0 && g_terminate ) { 72 #endif 67 73 term = 1; 68 74 } -
roard/network.c
r1484 r1494 24 24 25 25 #include "roard.h" 26 27 #ifdef ROAR_SUPPORT_LISTEN 26 28 27 29 #ifdef ROAR_BROKEN_PEERCRED … … 110 112 #endif 111 113 114 #endif 115 112 116 //ll -
roard/roard.c
r1486 r1494 25 25 #include "roard.h" 26 26 27 #ifdef ROAR_SUPPORT_LISTEN 27 28 char * server = ROAR_DEFAULT_SOCK_GLOBAL; // global server address 29 #endif 28 30 29 31 void usage (void) { … … 270 272 int i; 271 273 char * k; 274 #ifdef ROAR_SUPPORT_LISTEN 272 275 char user_sock[80] = {0}; 276 #endif 273 277 struct roar_audio_info sa; 274 278 #ifdef ROAR_HAVE_FORK … … 281 285 char * opts = NULL; 282 286 // char * server = ROAR_DEFAULT_SOCK_GLOBAL; 287 #ifdef ROAR_SUPPORT_LISTEN 283 288 int port = ROAR_DEFAULT_PORT; 289 #endif 284 290 int drvid; 285 291 char * s_drv = "cf"; … … 295 301 char * sock_grp = ROAR_DEFAULT_SOCKGRP; 296 302 char * sock_user = NULL; 303 #ifdef ROAR_SUPPORT_LISTEN 297 304 int sock_type = ROAR_SOCKET_TYPE_UNKNOWN; 305 #endif 298 306 #ifdef ROAR_HAVE_CHROOT 299 307 char * chrootdir = NULL; … … 320 328 #endif 321 329 322 g_listen_socket = -1;323 330 g_standby = 0; 324 331 g_autostandby = 0; 325 332 alive = 1; 333 #ifdef ROAR_SUPPORT_LISTEN 326 334 g_no_listen = 0; 335 g_listen_socket = -1; 336 #else 337 g_terminate = 1; 338 #endif 327 339 328 340 sa.bits = ROAR_BITS_DEFAULT; … … 334 346 335 347 348 #ifdef ROAR_SUPPORT_LISTEN 336 349 if ( getuid() != 0 && getenv("HOME") != NULL ) { 337 350 snprintf(user_sock, 79, "%s/%s", (char*)getenv("HOME"), ROAR_DEFAULT_SOCK_USER); … … 341 354 if ( getenv("ROAR_SERVER") != NULL ) 342 355 server = getenv("ROAR_SERVER"); 356 #endif 343 357 344 358 if ( clients_init() == -1 ) { … … 375 389 376 390 } else if ( strcmp(k, "--restart") == 0 ) { 391 #ifdef ROAR_SUPPORT_LISTEN 377 392 if ( restart_server(server) == -1 ) { 378 393 ROAR_WARN("Can not terminate old server (not running at %s?), tring to continue anyway", server); 379 394 } 395 #else 396 ROAR_ERR("--restart not supported"); 397 #endif 380 398 381 399 } else if ( strcmp(k, "--demon") == 0 || strcmp(k, "--daemon") == 0 ) { … … 472 490 } else if ( strcmp(k, "-p") == 0 || strcmp(k, "--port") == 0 ) { 473 491 // This is only usefull in INET not UNIX mode. 492 #ifdef ROAR_SUPPORT_LISTEN 474 493 if ( *server == '/' ) 475 494 server = ROAR_DEFAULT_HOST; … … 491 510 #endif 492 511 } 512 #endif 493 513 } else if ( strcmp(k, "-b") == 0 || strcmp(k, "--bind") == 0 || strcmp(k, "--sock") == 0 ) { 514 #ifdef ROAR_SUPPORT_LISTEN 494 515 server = argv[++i]; 516 #endif 495 517 496 518 } else if ( strcmp(k, "-t") == 0 || strcmp(k, "--tcp") == 0 ) { 519 #ifdef ROAR_SUPPORT_LISTEN 497 520 if ( sock_type != ROAR_SOCKET_TYPE_TCP && sock_type != ROAR_SOCKET_TYPE_TCP6 ) 498 521 sock_type = ROAR_SOCKET_TYPE_TCP; … … 500 523 if ( *server == '/' ) 501 524 server = ROAR_DEFAULT_HOST; 525 #endif 502 526 503 527 } else if ( strcmp(k, "-4") == 0 ) { 528 #ifdef ROAR_SUPPORT_LISTEN 504 529 sock_type = ROAR_SOCKET_TYPE_TCP; 505 530 if ( *server == '/' ) 506 531 server = ROAR_DEFAULT_HOST; 532 #endif 507 533 } else if ( strcmp(k, "-6") == 0 ) { 534 #ifdef ROAR_SUPPORT_LISTEN 508 535 #ifdef PF_INET6 509 536 sock_type = ROAR_SOCKET_TYPE_TCP6; … … 514 541 return 1; 515 542 #endif 543 #endif 516 544 517 545 } else if ( strcmp(k, "-u") == 0 || strcmp(k, "--unix") == 0 ) { 546 #ifdef ROAR_SUPPORT_LISTEN 518 547 // ignore this case as it is the default behavor. 519 548 sock_type = ROAR_SOCKET_TYPE_UNIX; 549 #endif 520 550 521 551 } else if ( strcmp(k, "-n") == 0 || strcmp(k, "--decnet") == 0 ) { 552 #ifdef ROAR_SUPPORT_LISTEN 522 553 #ifdef ROAR_HAVE_LIBDNET 523 554 port = ROAR_DEFAULT_NUM; … … 529 560 return 1; 530 561 #endif 562 #endif 531 563 532 564 } else if ( strcmp(k, "-G") == 0 ) { … … 536 568 537 569 } else if ( strcmp(k, "--no-listen") == 0 ) { 570 #ifdef ROAR_SUPPORT_LISTEN 538 571 *server = 0; 539 572 g_terminate = 1; 540 573 g_no_listen = 1; 574 #endif 541 575 } else if ( strcmp(k, "--client-fh") == 0 ) { 542 576 if ( clients_set_fh(clients_new(), atoi(argv[++i])) == -1 ) { … … 576 610 ROAR_ERR("Can not initialize MIDI subsystem"); 577 611 612 #ifdef ROAR_SUPPORT_LISTEN 578 613 if ( *server != 0 ) { 579 614 if ( (g_listen_socket = roar_socket_listen(sock_type, server, port)) == -1 ) { … … 635 670 #endif 636 671 } 672 #endif 637 673 638 674 if ( output_buffer_init(&sa) == -1 ) { … … 759 795 void cleanup_listen_socket (int terminate) { 760 796 797 #ifdef ROAR_SUPPORT_LISTEN 761 798 if ( g_listen_socket != -1 ) { 762 799 #ifdef ROAR_HAVE_IO_POSIX … … 771 808 #endif 772 809 } 810 811 #endif 773 812 774 813 if ( terminate )
Note: See TracChangeset
for help on using the changeset viewer.