cleaned up -nohold feature + rejection of new connections when in use

(for compatibility with possible future video streaming additions)
This commit is contained in:
F. Duncanh
2024-05-30 13:08:42 -04:00
parent 23030f1b43
commit 3579e84023
5 changed files with 93 additions and 36 deletions

View File

@@ -121,7 +121,7 @@ static unsigned short display[5] = {0}, tcp[3] = {0}, udp[3] = {0};
static bool debug_log = DEFAULT_DEBUG_LOG;
static int log_level = LOGGER_INFO;
static bool bt709_fix = false;
static int max_connections = 2;
static int nohold = 0;
static unsigned short raop_port;
static unsigned short airplay_port;
static uint64_t remote_clock_offset = 0;
@@ -1033,7 +1033,7 @@ static void parse_arguments (int argc, char *argv[]) {
} else if (arg == "-bt709") {
bt709_fix = true;
} else if (arg == "-nohold") {
max_connections = 3;
nohold = 1;
} else if (arg == "-al") {
int n;
char *end;
@@ -1825,8 +1825,8 @@ static int start_raop_server (unsigned short display[5], unsigned short tcp[3],
}
raop_set_log_callback(raop, log_callback, NULL);
raop_set_log_level(raop, log_level);
/* set max number of connections = 2 to protect against capture by new client */
if (raop_init2(raop, max_connections, mac_address.c_str(), keyfile.c_str())){
/* set nohold = 1 to allow capture by new client */
if (raop_init2(raop, nohold, mac_address.c_str(), keyfile.c_str())){
LOGE("Error initializing raop (2)!");
free (raop);
return -1;