NSM: Don't wait on clients that have died while executing a command.
This commit is contained in:
parent
d9ba4bda2b
commit
fad4f7938c
|
@ -97,6 +97,8 @@ enum {
|
||||||
|
|
||||||
static int pending_operation = COMMAND_NONE;
|
static int pending_operation = COMMAND_NONE;
|
||||||
|
|
||||||
|
static void wait ( long );
|
||||||
|
|
||||||
|
|
||||||
#define GUIMSG( fmt, args... ) \
|
#define GUIMSG( fmt, args... ) \
|
||||||
{ \
|
{ \
|
||||||
|
@ -352,7 +354,6 @@ handle_client_process_death ( int pid )
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void handle_sigchld ( )
|
void handle_sigchld ( )
|
||||||
{
|
{
|
||||||
for ( ;; )
|
for ( ;; )
|
||||||
|
@ -382,7 +383,6 @@ path_is_valid ( const char *path )
|
||||||
return r;
|
return r;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int
|
int
|
||||||
mkpath ( const char *path, bool create_final_directory )
|
mkpath ( const char *path, bool create_final_directory )
|
||||||
{
|
{
|
||||||
|
@ -545,7 +545,7 @@ wait_for_announce ( void )
|
||||||
{
|
{
|
||||||
n -= 100;
|
n -= 100;
|
||||||
|
|
||||||
osc_server->wait(100);
|
wait(100);
|
||||||
|
|
||||||
active = number_of_active_clients();
|
active = number_of_active_clients();
|
||||||
|
|
||||||
|
@ -568,7 +568,7 @@ wait_for_replies ( void )
|
||||||
{
|
{
|
||||||
n -= 100;
|
n -= 100;
|
||||||
|
|
||||||
osc_server->wait(100);
|
wait(100);
|
||||||
|
|
||||||
if ( ! replies_still_pending() )
|
if ( ! replies_still_pending() )
|
||||||
break;
|
break;
|
||||||
|
@ -2164,16 +2164,30 @@ OSC_HANDLER( null )
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
static void
|
||||||
|
wait ( long timeout )
|
||||||
|
{
|
||||||
|
struct signalfd_siginfo fdsi;
|
||||||
|
|
||||||
|
ssize_t s = read(signal_fd, &fdsi, sizeof(struct signalfd_siginfo));
|
||||||
|
|
||||||
|
if (s == sizeof(struct signalfd_siginfo))
|
||||||
|
{
|
||||||
|
if (fdsi.ssi_signo == SIGCHLD)
|
||||||
|
handle_sigchld();
|
||||||
|
}
|
||||||
|
|
||||||
|
osc_server->wait( timeout );
|
||||||
|
|
||||||
|
purge_dead_clients();
|
||||||
|
}
|
||||||
|
|
||||||
int main(int argc, char *argv[])
|
int main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
sigset_t mask;
|
sigset_t mask;
|
||||||
|
|
||||||
sigemptyset( &mask );
|
sigemptyset( &mask );
|
||||||
sigaddset( &mask, SIGCHLD );
|
sigaddset( &mask, SIGCHLD );
|
||||||
|
|
||||||
sigprocmask(SIG_BLOCK, &mask, NULL );
|
sigprocmask(SIG_BLOCK, &mask, NULL );
|
||||||
|
|
||||||
signal_fd = signalfd( -1, &mask, SFD_NONBLOCK );
|
signal_fd = signalfd( -1, &mask, SFD_NONBLOCK );
|
||||||
|
|
||||||
/* generate random seed for client ids */
|
/* generate random seed for client ids */
|
||||||
|
@ -2318,23 +2332,10 @@ int main(int argc, char *argv[])
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
struct signalfd_siginfo fdsi;
|
|
||||||
|
|
||||||
|
|
||||||
/* listen for sigchld signals and process OSC messages forever */
|
/* listen for sigchld signals and process OSC messages forever */
|
||||||
for ( ;; )
|
for ( ;; )
|
||||||
{
|
{
|
||||||
ssize_t s = read(signal_fd, &fdsi, sizeof(struct signalfd_siginfo));
|
wait( 1000 );
|
||||||
|
|
||||||
if (s == sizeof(struct signalfd_siginfo))
|
|
||||||
{
|
|
||||||
if (fdsi.ssi_signo == SIGCHLD)
|
|
||||||
handle_sigchld();
|
|
||||||
}
|
|
||||||
|
|
||||||
osc_server->wait( 1000 );
|
|
||||||
|
|
||||||
purge_dead_clients();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// osc_server->run();
|
// osc_server->run();
|
||||||
|
|
Loading…
Reference in New Issue