#define STK_FL_RECV_ONLY 0x01 /* table is assumed to be remotely updated only
* (never updated locally)
*/
+#define STK_FL_NOPURGE 0x02 /* if non-zero, don't purge sticky sessions when full */
/* stick table */
struct stktable {
size_t key_size; /* size of a key, maximum size in case of string */
unsigned int server_key_type; /* What type of key is used to identify servers */
unsigned int size; /* maximum number of sticky sessions in table */
- int nopurge; /* if non-zero, don't purge sticky sessions when full */
int expire; /* time to live for sticky sessions (milliseconds) */
int data_size; /* the size of the data that is prepended *before* stksess */
int data_ofs[STKTABLE_DATA_TYPES]; /* negative offsets of present data types, or 0 if absent */
unsigned int data_nbelem[STKTABLE_DATA_TYPES]; /* to store nb_elem in case of array types */
unsigned int brates_factor; /* Factor used for IN/OUT bytes rates */
+ uint16_t flags;
+ /* 2-bytes hole */
union {
int i;
unsigned int u;
void *ptr; /* generic ptr to check if set or not */
} write_to; /* updates received on the source table will also update write_to */
- uint16_t flags;
-
THREAD_ALIGN(64);
struct {
lua_settable(L, -3);
lua_pushstring(L, "nopurge");
- lua_pushboolean(L, tbl->nopurge > 0);
+ lua_pushboolean(L, (tbl->flags & STK_FL_NOPURGE));
lua_settable(L, -3);
lua_pushstring(L, "expire");
if (unlikely(current >= t->size)) {
/* the table was already full, we may have to purge entries */
- if (t->nopurge || !stktable_trash_oldest(t, (t->size >> 8) + 1)) {
+ if ((t->flags & STK_FL_NOPURGE) ||
+ !stktable_trash_oldest(t, (t->size >> 8) + 1)) {
HA_ATOMIC_DEC(&t->current);
return NULL;
}
idx++;
}
else if (strcmp(args[idx], "nopurge") == 0) {
- t->nopurge = 1;
+ t->flags |= STK_FL_NOPURGE;
idx++;
}
else if (strcmp(args[idx], "type") == 0) {