Use pending status only with running monitors

If a monitor is stopped, it is OK to modify the state of the server
without putting it into the pending status variable.
This commit is contained in:
Markus Mäkelä
2016-12-21 21:53:10 +02:00
parent 6da835ee44
commit 06d362765c

View File

@ -1313,7 +1313,7 @@ void server_set_status(SERVER *server, int bit)
*/ */
MONITOR *mon = monitor_server_in_use(server); MONITOR *mon = monitor_server_in_use(server);
spinlock_acquire(&server->lock); spinlock_acquire(&server->lock);
if (mon) if (mon && mon->state == MONITOR_STATE_RUNNING)
{ {
/* Set a pending status bit. It will be activated on the next monitor /* Set a pending status bit. It will be activated on the next monitor
* loop. Also set a flag so the next loop happens sooner. * loop. Also set a flag so the next loop happens sooner.
@ -1340,7 +1340,7 @@ void server_clear_status(SERVER *server, int bit)
{ {
MONITOR *mon = monitor_server_in_use(server); MONITOR *mon = monitor_server_in_use(server);
spinlock_acquire(&server->lock); spinlock_acquire(&server->lock);
if (mon) if (mon && mon->state == MONITOR_STATE_RUNNING)
{ {
/* Clear a pending status bit. It will be activated on the next monitor /* Clear a pending status bit. It will be activated on the next monitor
* loop. Also set a flag so the next loop happens sooner. * loop. Also set a flag so the next loop happens sooner.