const char *proxy_cap_str(int cap);
const char *proxy_mode_str(int mode);
const char *proxy_find_best_option(const char *word, const char **extra);
+uint proxy_get_next_id(uint from);
void proxy_store_name(struct proxy *px);
struct proxy *proxy_find_by_id(int id, int cap, int table);
struct proxy *proxy_find_by_name(const char *name, int cap, int table);
* build or config options and we don't want them to
* possibly reuse existing IDs.
*/
- next_pxid = get_next_id(&used_proxy_id, next_pxid);
+ next_pxid = proxy_get_next_id(next_pxid);
curproxy->conf.id.key = curproxy->uuid = next_pxid;
eb32_insert(&used_proxy_id, &curproxy->conf.id);
}
return best_ptr;
}
+/* This function returns the first unused proxy ID greater than or equal to
+ * <from> in used_proxy_id. Zero is returned if no spare one is found (should
+ * never happen).
+ */
+uint proxy_get_next_id(uint from)
+{
+ struct eb32_node *used;
+
+ do {
+ used = eb32_lookup_ge(&used_proxy_id, from);
+ if (!used || used->key > from)
+ return from; /* available */
+ from++;
+ } while (from);
+ return from;
+}
+
/* This function parses a "timeout" statement in a proxy section. It returns
* -1 if there is any error, 1 for a warning, otherwise zero. If it does not
* return zero, it will write an error or warning message into a preallocated