From c94066f80a4e0ad71bc0b4dba2eef3e37557062b Mon Sep 17 00:00:00 2001 From: joq Date: Thu, 25 Nov 2004 01:58:42 +0000 Subject: [PATCH] [0.99.12] client limit fix git-svn-id: svn+ssh://jackaudio.org/trunk/jack@803 0c269be4-1314-0410-8aa9-9f06e86f4224 --- configure.ac | 2 +- example-clients/simple_client.c | 5 +++++ jackd/engine.c | 15 ++++++--------- 3 files changed, 12 insertions(+), 10 deletions(-) diff --git a/configure.ac b/configure.ac index a881c0f..6a1530e 100644 --- a/configure.ac +++ b/configure.ac @@ -15,7 +15,7 @@ dnl changes are made dnl --- JACK_MAJOR_VERSION=0 JACK_MINOR_VERSION=99 -JACK_MICRO_VERSION=11 +JACK_MICRO_VERSION=12 dnl --- dnl HOWTO: updating the jack protocol version diff --git a/example-clients/simple_client.c b/example-clients/simple_client.c index 3ed5199..8f3d23d 100644 --- a/example-clients/simple_client.c +++ b/example-clients/simple_client.c @@ -136,6 +136,11 @@ main (int argc, char *argv[]) JACK_DEFAULT_AUDIO_TYPE, JackPortIsOutput, 0); + if ((input_port == NULL) || (output_port == NULL)) { + fprintf(stderr, "no more JACK ports available\n"); + exit (1); + } + /* Tell the JACK server that we are ready to roll. Our * process() callback will start running now. */ diff --git a/jackd/engine.c b/jackd/engine.c index 600e4a9..5810525 100644 --- a/jackd/engine.c +++ b/jackd/engine.c @@ -1895,19 +1895,12 @@ jack_server_thread (void *arg) engine->pfd[1].fd = engine->fds[1]; engine->pfd[1].events = POLLIN|POLLERR; engine->pfd_max = 2; + pfd = engine->pfd; + max = engine->pfd_max; while (!done) { DEBUG ("start while"); - /* XXX race here with new external clients - causing engine->pfd to be reallocated. - I don't know how to solve this - short of copying the entire - contents of the pfd struct. Ick. - */ - - max = engine->pfd_max; - pfd = engine->pfd; if (poll (pfd, max, 10000) < 0) { if (errno == EINTR) { @@ -1979,6 +1972,10 @@ jack_server_thread (void *arg) close (client_socket); } } + + /* handle_new_client() may have realloced engine->pfd */ + pfd = engine->pfd; + max = engine->pfd_max; /* check the ACK server socket */