NSM: Further clarify nsmd debugging output regarding client death.
This commit is contained in:
parent
7bbc97983b
commit
299193dc60
|
@ -302,38 +302,36 @@ handle_client_process_death ( int pid )
|
||||||
|
|
||||||
if ( c )
|
if ( c )
|
||||||
{
|
{
|
||||||
|
bool dead_because_we_said = ( c->pending_command() == COMMAND_KILL ||
|
||||||
|
c->pending_command() == COMMAND_QUIT );
|
||||||
|
|
||||||
bool dead_because_we_said = false;
|
if ( dead_because_we_said )
|
||||||
|
|
||||||
if ( c->pending_command() == COMMAND_KILL ||
|
|
||||||
c->pending_command() == COMMAND_QUIT )
|
|
||||||
{
|
{
|
||||||
dead_because_we_said = true;
|
MESSAGE( "Client %s terminated because we told it to.", c->name );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
MESSAGE( "Client %s died unexpectedly.", c->name );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ( c->pending_command() == COMMAND_QUIT )
|
||||||
|
{
|
||||||
|
if ( gui_is_active )
|
||||||
|
osc_server->send( gui_addr, "/nsm/gui/client/status", c->client_id, c->status = "removed" );
|
||||||
|
|
||||||
|
client.remove(c);
|
||||||
|
delete c;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if ( gui_is_active )
|
||||||
|
osc_server->send( gui_addr, "/nsm/gui/client/status", c->client_id, c->status = "stopped" );
|
||||||
|
}
|
||||||
|
|
||||||
c->pending_command( COMMAND_NONE );
|
c->pending_command( COMMAND_NONE );
|
||||||
|
|
||||||
c->active = false;
|
c->active = false;
|
||||||
c->pid = 0;
|
c->pid = 0;
|
||||||
|
|
||||||
if ( dead_because_we_said )
|
|
||||||
{
|
|
||||||
MESSAGE( "Client %s terminated because we told it to.", c->name );
|
|
||||||
if ( gui_is_active )
|
|
||||||
osc_server->send( gui_addr, "/nsm/gui/client/status", c->client_id, c->status = "removed" );
|
|
||||||
|
|
||||||
client.remove( c );
|
|
||||||
|
|
||||||
delete c;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
MESSAGE( "Client %s died unexpectedly.", c->name );
|
|
||||||
|
|
||||||
if ( gui_is_active )
|
|
||||||
osc_server->send( gui_addr, "/nsm/gui/client/status", c->client_id, c->status = "stopped" );
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -995,6 +993,21 @@ command_all_clients_to_save ( )
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
command_client_to_stop ( Client *c )
|
||||||
|
{
|
||||||
|
MESSAGE( "Stopping client %s", c->name );
|
||||||
|
|
||||||
|
if ( c->pid > 0 )
|
||||||
|
{
|
||||||
|
c->pending_command( COMMAND_KILL );
|
||||||
|
|
||||||
|
kill( c->pid, SIGTERM );
|
||||||
|
|
||||||
|
if ( gui_is_active )
|
||||||
|
osc_server->send( gui_addr, "/nsm/gui/client/status", c->client_id, c->status = "stopped" );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
command_client_to_quit ( Client *c )
|
command_client_to_quit ( Client *c )
|
||||||
|
@ -1015,10 +1028,10 @@ command_client_to_quit ( Client *c )
|
||||||
if ( c->pid > 0 )
|
if ( c->pid > 0 )
|
||||||
{
|
{
|
||||||
if ( gui_is_active )
|
if ( gui_is_active )
|
||||||
osc_server->send( gui_addr, "/nsm/gui/client/status", c->client_id, c->status = "kill" );
|
osc_server->send( gui_addr, "/nsm/gui/client/status", c->client_id, c->status = "quit" );
|
||||||
|
|
||||||
/* should be kill? */
|
/* should be kill? */
|
||||||
c->pending_command( COMMAND_KILL );
|
c->pending_command( COMMAND_QUIT );
|
||||||
|
|
||||||
// this is a dumb client... try and kill it
|
// this is a dumb client... try and kill it
|
||||||
kill( c->pid, SIGTERM );
|
kill( c->pid, SIGTERM );
|
||||||
|
@ -1897,14 +1910,11 @@ OSC_HANDLER( stop )
|
||||||
|
|
||||||
if ( c )
|
if ( c )
|
||||||
{
|
{
|
||||||
if ( c->pid != 0 )
|
command_client_to_stop( c );
|
||||||
{
|
|
||||||
kill( c->pid, SIGTERM );
|
|
||||||
|
|
||||||
if ( gui_is_active )
|
if ( gui_is_active )
|
||||||
osc_server->send( gui_addr, "/reply", "Client stopped." );
|
osc_server->send( gui_addr, "/reply", "Client stopped." );
|
||||||
}
|
}
|
||||||
}
|
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if ( gui_is_active )
|
if ( gui_is_active )
|
||||||
|
|
Loading…
Reference in New Issue