Do hangups only after server states have been updated

The hangup code was refactored into a common function which should only be
used after the server states have been updated. This will remove erroneus
connections to already failed servers.
This commit is contained in:
Markus Makela
2016-11-09 13:46:02 +02:00
parent b12a87ef04
commit 7ef8b187b5
6 changed files with 30 additions and 32 deletions

View File

@ -860,22 +860,6 @@ monitorMain(void *arg)
ptr->server->name,
ptr->server->port);
}
/**
* Here we say: If the server's state changed
* so that it isn't running or some other way
* lost cluster membership, call call-back function
* of every DCB for which such callback was
* registered for this kind of issue (DCB_REASON_...)
*/
if (!(SERVER_IS_RUNNING(ptr->server)) ||
!(SERVER_IS_IN_CLUSTER(ptr->server)))
{
dcb_hangup_foreach(ptr->server);
}
}
if (mon_status_changed(ptr))
@ -1090,6 +1074,8 @@ monitorMain(void *arg)
ptr = ptr->next;
}
}
mon_hangup_failed_servers(mon);
} /*< while (1) */
}