In stick_table->proto_size, we now store the estimated worse case for
the size of a key sent over the wire with all of its stored data. This
includes the key itself when it's fixed, the upper bound for stored
data, and some overhead (11 bytes measured). It will be used by next
commit.
unsigned int size; /* maximum number of sticky sessions in table */
int expire; /* time to live for sticky sessions (milliseconds) */
int data_size; /* the size of the data that is prepended *before* stksess */
+ int proto_size; /* the rough size of the data+fixed key over the peers protocol */
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 */
}
t->data_size += t->data_nbelem[type] * stktable_type_size(stktable_data_types[type].std_type);
+ t->proto_size += t->data_nbelem[type] * stktable_type_proto_size(stktable_data_types[type].std_type);
t->data_ofs[type] = -t->data_size;
return PE_NONE;
}
goto out;
}
+ /* the key is sent as-is for most types (string is trimmed), and 11
+ * extra bytes of encapsulation are added when sending (measured).
+ */
+ t->proto_size += 11;
+ if (t->type != SMP_T_STR)
+ t->proto_size += t->key_size;
+
out:
return err_code;
}