aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMattias Andrée <maandree@operamail.com>2014-05-18 02:04:37 +0200
committerMattias Andrée <maandree@operamail.com>2014-05-18 02:04:37 +0200
commitb248298b34deb98c19133c0d743ddcc1ce24d9e0 (patch)
tree5b992544ddcd894f48c417f9dc92ef1aa45fec55
parentFix reading of payload (diff)
downloadmds-b248298b34deb98c19133c0d743ddcc1ce24d9e0.tar.gz
mds-b248298b34deb98c19133c0d743ddcc1ce24d9e0.tar.bz2
mds-b248298b34deb98c19133c0d743ddcc1ce24d9e0.tar.xz
m doc
Signed-off-by: Mattias Andrée <maandree@operamail.com>
-rw-r--r--src/mds-server/mds-server.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/mds-server/mds-server.c b/src/mds-server/mds-server.c
index 2f53a12..93849ff 100644
--- a/src/mds-server/mds-server.c
+++ b/src/mds-server/mds-server.c
@@ -1028,14 +1028,19 @@ void add_intercept_condition(client_t* client, char* condition, int64_t priority
return;
}
+ /* Split header and value apart. */
if ((value = strchr(header, ':')) != NULL)
{
*value = '\0'; /* NUL-terminate header. */
value += 2; /* Skip over delimiter. */
}
+ /* Calcuate header hash (comparison optimisation) */
hash = string_hash(header);
+ /* Remove of update condition of already registered,
+ also look for non-modifying condition to swap position
+ with for optimisation. */
for (i = 0; i < n; i++)
{
if (conds[i].header_hash == hash)
@@ -1046,7 +1051,7 @@ void add_intercept_condition(client_t* client, char* condition, int64_t priority
/* Remove the condition from the list. */
memmove(conds + i, conds + i + 1, --n - i);
client->interception_conditions_count--;
- /* Diminish the list. */
+ /* Shrink the list. */
if (n == 0)
{
free(conds);