}
+/*
+ * Must be called with the server lock held.
+ */
void srv_set_dyncookie(struct server *s)
{
struct proxy *p = s->proxy;
/* Shutdown all connections of a server. The caller must pass a termination
* code in <why>, which must be one of SF_ERR_* indicating the reason for the
* shutdown.
+ *
+ * Must be called with the server lock held.
*/
void srv_shutdown_streams(struct server *srv, int why)
{
/* Shutdown all connections of all backup servers of a proxy. The caller must
* pass a termination code in <why>, which must be one of SF_ERR_* indicating
* the reason for the shutdown.
+ *
+ * Must be called with the server lock held.
*/
void srv_shutdown_backup_streams(struct proxy *px, int why)
{
* using the check results stored into the struct server if present.
* If <xferred> is non-negative, some information about requeued sessions are
* provided.
+ *
+ * Must be called with the server lock held.
*/
void srv_append_status(struct buffer *msg, struct server *s,
struct check *check, int xferred, int forced)
* a sync point. Maintenance servers are ignored. It stores the <reason> if
* non-null as the reason for going down or the available data from the check
* struct to recompute this reason later.
+ *
+ * Must be called with the server lock held.
*/
void srv_set_stopped(struct server *s, const char *reason, struct check *check)
{
* proxy at a sync point. Maintenance servers are ignored. It stores the
* <reason> if non-null as the reason for going down or the available data
* from the check struct to recompute this reason later.
+ *
+ * Must be called with the server lock held.
*/
void srv_set_running(struct server *s, const char *reason, struct check *check)
{
* from the check struct to recompute this reason later.
* up. Note that it makes use of the trash to build the log strings, so <reason>
* must not be placed there.
+ *
+ * Must be called with the server lock held.
*/
void srv_set_stopping(struct server *s, const char *reason, struct check *check)
{
* checks). When either the flag is already set or no flag is passed, nothing
* is done. If <cause> is non-null, it will be displayed at the end of the log
* lines to justify the state change.
+ *
+ * Must be called with the server lock held.
*/
void srv_set_admin_flag(struct server *s, enum srv_admin mode, const char *cause)
{
* than one flag at once. The equivalent "inherited" flag is propagated to all
* tracking servers. Leaving maintenance mode re-enables health checks. When
* either the flag is already cleared or no flag is passed, nothing is done.
+ *
+ * Must be called with the server lock held.
*/
void srv_clr_admin_flag(struct server *s, enum srv_admin mode)
{
* and the proxy's algorihtm. To be used after updating sv->uweight. The warmup
* state is automatically disabled if the time is elapsed. If <must_update> is
* not zero, the update will be propagated immediately.
+ *
+ * Must be called with the server lock held.
*/
void server_recalc_eweight(struct server *sv, int must_update)
{
/*
* Parses weight_str and configures sv accordingly.
* Returns NULL on success, error message string otherwise.
+ *
+ * Must be called with the server lock held.
*/
const char *server_parse_weight_change_request(struct server *sv,
const char *weight_str)
* Returns:
* - error string on error
* - NULL on success
+ *
+ * Must be called with the server lock held.
*/
const char *server_parse_addr_change_request(struct server *sv,
const char *addr_str, const char *updater)
return "Could not understand IP address format.\n";
}
+/*
+ * Must be called with the server lock held.
+ */
const char *server_parse_maxconn_change_request(struct server *sv,
const char *maxconn_str)
{
return NULL;
}
-/* Update a server state using the parameters available in the params list */
+/* Update a server state using the parameters available in the params list.
+ *
+ * Grabs the server lock during operation.
+ */
static void srv_update_state(struct server *srv, int version, char **params)
{
char *p;
*
* If the running backend uuid or id differs from the state file, then HAProxy reports
* a warning.
+ *
+ * Grabs the server's lock via srv_update_state().
*/
void apply_server_state(void)
{
* updater is used if not NULL.
*
* A log line and a stderr warning message is generated based on server's backend options.
+ *
+ * Must be called with the server lock held.
*/
int update_server_addr(struct server *s, void *ip, int ip_sin_family, const char *updater)
{
* - if switch to port map (SRV_F_MAPPORTS), ensure health check have their own ports
* - applies required changes to both ADDR and PORT if both 'required' and 'allowed'
* conditions are met
+ *
+ * Must be called with the server lock held.
*/
const char *update_server_addr_port(struct server *s, const char *addr, const char *port, char *updater)
{
* returns:
* 0 if server status is updated
* 1 if server status has not changed
+ *
+ * Must be called with the server lock held.
*/
int snr_update_srv_status(struct server *s, int has_no_ip)
{
* returns:
* 0 on error
* 1 when no error or safe ignore
+ *
+ * Grabs the server's lock.
*/
int snr_resolution_error_cb(struct dns_requester *requester, int error_code)
{
/* Set the server's FDQN (->hostname) from <hostname>.
* Returns -1 if failed, 0 if not.
+ *
+ * Must be called with the server lock held.
*/
int srv_set_fqdn(struct server *srv, const char *hostname, int dns_locked)
{
return return_code;
}
+/*
+ * Must be called with the server lock held.
+ */
const char *update_server_fqdn(struct server *server, const char *fqdn, const char *updater, int dns_locked)
{
}
+/* grabs the server lock */
static int cli_parse_set_server(char **args, char *payload, struct appctx *appctx, void *private)
{
struct server *sv;
return 1;
}
+/*
+ * Must be called with the server lock held.
+ */
static int cli_parse_set_weight(char **args, char *payload, struct appctx *appctx, void *private)
{
struct server *sv;
return 1;
}
-/* parse a "set maxconn server" command. It always returns 1. */
+/* parse a "set maxconn server" command. It always returns 1.
+ *
+ * Must be called with the server lock held.
+ */
static int cli_parse_set_maxconn_server(char **args, char *payload, struct appctx *appctx, void *private)
{
struct server *sv;
return 1;
}
-/* parse a "disable agent" command. It always returns 1. */
+/* parse a "disable agent" command. It always returns 1.
+ *
+ * Must be called with the server lock held.
+ */
static int cli_parse_disable_agent(char **args, char *payload, struct appctx *appctx, void *private)
{
struct server *sv;
return 1;
}
-/* parse a "disable health" command. It always returns 1. */
+/* parse a "disable health" command. It always returns 1.
+ *
+ * Must be called with the server lock held.
+ */
static int cli_parse_disable_health(char **args, char *payload, struct appctx *appctx, void *private)
{
struct server *sv;
return 1;
}
-/* parse a "disable server" command. It always returns 1. */
+/* parse a "disable server" command. It always returns 1.
+ *
+ * Must be called with the server lock held.
+ */
static int cli_parse_disable_server(char **args, char *payload, struct appctx *appctx, void *private)
{
struct server *sv;
return 1;
}
-/* parse a "enable agent" command. It always returns 1. */
+/* parse a "enable agent" command. It always returns 1.
+ *
+ * Must be called with the server lock held.
+ */
static int cli_parse_enable_agent(char **args, char *payload, struct appctx *appctx, void *private)
{
struct server *sv;
return 1;
}
-/* parse a "enable health" command. It always returns 1. */
+/* parse a "enable health" command. It always returns 1.
+ *
+ * Must be called with the server lock held.
+ */
static int cli_parse_enable_health(char **args, char *payload, struct appctx *appctx, void *private)
{
struct server *sv;
return 1;
}
-/* parse a "enable server" command. It always returns 1. */
+/* parse a "enable server" command. It always returns 1.
+ *
+ * Must be called with the server lock held.
+ */
static int cli_parse_enable_server(char **args, char *payload, struct appctx *appctx, void *private)
{
struct server *sv;
* This function applies server's status changes, it is
* is designed to be called asynchronously.
*
+ * Must be called with the server lock held.
*/
static void srv_update_status(struct server *s)
{