/*
- * include/haproxy/proto_dgram.h
+ * include/haproxy/dgram.h
* This file provides functions related to DGRAM processing.
*
* Copyright (C) 2014 Baptiste Assmann <bedis9@gmail.com>
int protocol_enable_all(void);
/* returns the protocol associated to family <family> with proto_type among the
- * supported protocol types, and ctrl_type of either SOCK_STREAM or SOCK_DGRAM
- * depending on the requested values, or NULL if not found.
+ * supported protocol types, and index <alt> (0 or 1) selecting between the two
+ * possible entries per (family, proto_type), or NULL if not found.
*/
static inline struct protocol *protocol_lookup(int family, enum proto_type proto_type, int alt)
{
};
struct queue {
- struct eb_root head; /* queued pendconnds */
+ struct eb_root head; /* queued pendconns */
struct proxy *px; /* the proxy we're waiting for, never NULL in queue */
struct server *sv; /* the server we are waiting for, may be NULL if don't care */
__decl_thread(HA_SPINLOCK_T lock); /* for manipulations in the tree */
/* renumber clusters and assign unassigned ones at the same
* time. For this, we'll compare pkg/die/llc with the last
* CPU's and verify if we need to create a new cluster ID.
- * Note that some platforms don't report cache. The locao value
+ * Note that some platforms don't report cache. The local value
* is local to the pkg+node combination so that we reset it
* when changing, contrary to the global one which grows.
*/
ha_cpu_clusters[cpu].idx = cpu;
}
- /* pre-inizialize the configured CPU sets */
+ /* pre-initialize the configured CPU sets */
ha_cpuset_zero(&cpu_set_cfg.drop_cpus);
ha_cpuset_zero(&cpu_set_cfg.only_cpus);
ha_cpuset_zero(&cpu_set_cfg.drop_nodes);
/*
* debug dev stream [strm=<ptr>] [strm.f[{+-=}<flags>]] [txn.f[{+-=}<flags>]] \
* [req.f[{+-=}<flags>]] [res.f[{+-=}<flags>]] \
- * [sif.f[{+-=<flags>]] [sib.f[{+-=<flags>]] \
- * [sif.s[=<state>]] [sib.s[=<state>]]
+ * [scf.s[=<state>]] [scb.s[=<state>]]
*/
static int debug_parse_cli_stream(char **args, char *payload, struct appctx *appctx, void *private)
{
*/
static int debug_parse_delay_inj(char **args, char *payload, struct appctx *appctx, void *private)
{
- unsigned long *tctx; // [0] = inter, [2] = count
+ unsigned long *tctx; // [0] = inter, [1] = nbwakeups
struct task *task;
if (!cli_has_level(appctx, ACCESS_LVL_ADMIN))
}
/*
- * Simple function to lookup dictionary entries with <s> as value.
+ * Simple function to lookup dictionary entries with <s> as key.
*/
static struct dict_entry *__dict_lookup(struct dict *d, const char *s)
{
}
/*
- * Insert an entry in <d> dictionary with <s> as value. *
+ * Insert an entry in <d> dictionary with <s> as key.
*/
struct dict_entry *dict_insert(struct dict *d, char *s)
{
if (!(_HA_ATOMIC_LOAD(&proto->flags) & PROTO_F_REUSEPORT_SUPPORTED))
return 0;
- /* at least nobody said it was not supported */
+ /* TESTED is set, assume supported (live test already ran and passed) */
if (_HA_ATOMIC_LOAD(&proto->flags) & PROTO_F_REUSEPORT_TESTED)
return 1;
}
/* enables all listeners of all registered protocols. This is intended to be
- * used after a fork() to enable reading on all file descriptors. Returns
- * composition of ERR_NONE.
+ * used after a fork() to enable reading on all file descriptors. Returns ERR_NONE.
*/
int protocol_enable_all(void)
{
* - if p->node.node.leaf_p is NULL, the element is unlinked,
* otherwise it necessarily belongs to one of the other lists ; this may
* not be atomically checked under threads though ;
- * - pendconn->px is never NULL if pendconn->list is not empty
- * - pendconn->srv is never NULL if pendconn->list is in the server's queue,
- * and is always NULL if pendconn->list is in the backend's queue or empty.
+ * - pendconn->queue->px is never NULL if pendconn->node.node.leaf_p is not NULL
+ * - pendconn->queue->sv is never NULL if pendconn is in the server's queue,
+ * and is always NULL if it is in the proxy's queue or unlinked.
* - pendconn->target is NULL while the element is queued, and points to the
* assigned server when the pendconn is picked.
*
* - a pendconn_add() is only performed by the stream which will own the
* pendconn ; the pendconn is allocated at this moment and returned ; it is
* added to either the server or the proxy's queue while holding this
-s * queue's lock.
+ * queue's lock.
*
* - the pendconn is then met by a thread walking over the proxy or server's
* queue with the respective lock held. This lock is exclusive and the
* on the queue the pendconn is attached to.
*
* - no single operation except the pendconn initialisation prior to the
- * insertion are performed without eithre a queue lock held or the element
+ * insertion are performed without either a queue lock held or the element
* being unlinked and visible exclusively to its stream.
*
* - pendconn_process_next_strm() assign ->target so that the stream knows
* up to the caller to atomically decrement the pending counts.
*
* The caller must own the lock on the server queue. The pendconn must still be
- * queued (p->node.leaf_p != NULL) and must be in a server (p->srv != NULL).
+ * queued (p->node.node.leaf_p != NULL) and must be in a server queue
+ * (p->queue->sv != NULL).
*/
static void __pendconn_unlink_srv(struct pendconn *p)
{
* up to the caller to atomically decrement the pending counts.
*
* The caller must own the lock on the proxy queue. The pendconn must still be
- * queued (p->node.leaf_p != NULL) and must be in the proxy (p->srv == NULL).
+ * queued (p->node.node.leaf_p != NULL) and must be in the proxy queue
+ * (p->queue->sv == NULL).
*/
static void __pendconn_unlink_prx(struct pendconn *p)
{
eb32_delete(&p->node);
}
-/* Locks the queue the pendconn element belongs to. This relies on both p->px
- * and p->srv to be properly initialized (which is always the case once the
- * element has been added).
+/* Locks the queue the pendconn element belongs to. This relies on p->queue
+ * being properly initialized (which is always the case once the element
+ * has been added).
*/
static inline void pendconn_queue_lock(struct pendconn *p)
{
HA_SPIN_LOCK(QUEUE_LOCK, &p->queue->lock);
}
-/* Unlocks the queue the pendconn element belongs to. This relies on both p->px
- * and p->srv to be properly initialized (which is always the case once the
- * element has been added).
+/* Unlocks the queue the pendconn element belongs to. This relies on p->queue
+ * being properly initialized (which is always the case once the element
+ * has been added).
*/
static inline void pendconn_queue_unlock(struct pendconn *p)
{
if (unlikely((flags & CO_RFL_TRY_HARDER) &&
!(conn->flags & CO_FL_SOCK_RD_SH) &&
!count)) {
- /* we've read exactly what was being asked for, which is loewr
+ /* we've read exactly what was being asked for, which is lower
* than a full buffer, and the caller wants us to really check
* if there's something after. This happens in the context of
* SSL where the lib reads in tiny chunks without offering the
}
}
-/* parse a "trace" statement in the "global" section, returns 1 if a message is returned, otherwise zero */
+/* parse a "trace" statement in the "global" section, returns -1 on error, zero otherwise */
static int cfg_parse_trace(char **args, int section_type, struct proxy *curpx,
const struct proxy *defpx, const char *file, int line,
char **err)
fail1:
per_thread_wd_ctx[tid].timer = TIMER_INVALID;
ha_warning("Failed to setup watchdog timer for thread %u, disabling lockup detection.\n", tid);
+ /* don't fail to start just for this */
return 1;
}